cgen: fix eq generation for translated code
parent
5ada79c629
commit
f66e514430
|
@ -116,6 +116,10 @@ fn (mut g Gen) infix_expr_eq_op(node ast.InfixExpr) {
|
||||||
g.write(')')
|
g.write(')')
|
||||||
} else if left.typ.idx() == right.typ.idx()
|
} else if left.typ.idx() == right.typ.idx()
|
||||||
&& left.sym.kind in [.array, .array_fixed, .alias, .map, .struct_, .sum_type, .interface_] {
|
&& left.sym.kind in [.array, .array_fixed, .alias, .map, .struct_, .sum_type, .interface_] {
|
||||||
|
if g.pref.translated && !g.is_builtin_mod {
|
||||||
|
g.gen_plain_infix_expr(node)
|
||||||
|
return
|
||||||
|
}
|
||||||
match left.sym.kind {
|
match left.sym.kind {
|
||||||
.alias {
|
.alias {
|
||||||
ptr_typ := g.equality_fn(left.typ)
|
ptr_typ := g.equality_fn(left.typ)
|
||||||
|
@ -201,9 +205,9 @@ fn (mut g Gen) infix_expr_eq_op(node ast.InfixExpr) {
|
||||||
g.write(')')
|
g.write(')')
|
||||||
}
|
}
|
||||||
.struct_ {
|
.struct_ {
|
||||||
if g.pref.translated {
|
// if g.pref.translated {
|
||||||
g.gen_plain_infix_expr(node)
|
// g.gen_plain_infix_expr(node)
|
||||||
} else {
|
//} else {
|
||||||
ptr_typ := g.equality_fn(left.unaliased)
|
ptr_typ := g.equality_fn(left.unaliased)
|
||||||
if node.op == .ne {
|
if node.op == .ne {
|
||||||
g.write('!')
|
g.write('!')
|
||||||
|
@ -219,7 +223,7 @@ fn (mut g Gen) infix_expr_eq_op(node ast.InfixExpr) {
|
||||||
}
|
}
|
||||||
g.expr(node.right)
|
g.expr(node.right)
|
||||||
g.write(')')
|
g.write(')')
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
.sum_type {
|
.sum_type {
|
||||||
ptr_typ := g.equality_fn(left.unaliased)
|
ptr_typ := g.equality_fn(left.unaliased)
|
||||||
|
|
Loading…
Reference in New Issue