From 77593d6c686d5a4f3c7f4ec7c4cab5d9f47ac070 Mon Sep 17 00:00:00 2001 From: yuyi Date: Mon, 18 Apr 2022 20:05:19 +0800 Subject: [PATCH] cgen: minor cleanup of infix_expr.v (#14070) --- vlib/v/gen/c/{infix_expr.v => infix.v} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename vlib/v/gen/c/{infix_expr.v => infix.v} (98%) diff --git a/vlib/v/gen/c/infix_expr.v b/vlib/v/gen/c/infix.v similarity index 98% rename from vlib/v/gen/c/infix_expr.v rename to vlib/v/gen/c/infix.v index 3857905f65..d080855f1e 100644 --- a/vlib/v/gen/c/infix_expr.v +++ b/vlib/v/gen/c/infix.v @@ -495,14 +495,14 @@ fn (mut g Gen) infix_expr_in_optimization(left ast.Expr, right ast.ArrayInit) { // infix_expr_is_op generates code for `is` and `!is` fn (mut g Gen) infix_expr_is_op(node ast.InfixExpr) { - mut sym := g.table.sym(node.left_type) - is_aggregate := sym.kind == .aggregate + mut left_sym := g.table.sym(node.left_type) + is_aggregate := left_sym.kind == .aggregate if is_aggregate { - parent_left_type := (sym.info as ast.Aggregate).sum_type - sym = g.table.sym(parent_left_type) + parent_left_type := (left_sym.info as ast.Aggregate).sum_type + left_sym = g.table.sym(parent_left_type) } right_sym := g.table.sym(node.right_type) - if sym.kind == .interface_ && right_sym.kind == .interface_ { + if left_sym.kind == .interface_ && right_sym.kind == .interface_ { g.gen_interface_is_op(node) return } @@ -520,7 +520,7 @@ fn (mut g Gen) infix_expr_is_op(node ast.InfixExpr) { } else { g.write('.') } - if sym.kind == .interface_ { + if left_sym.kind == .interface_ { g.write('_typ $cmp_op ') // `_Animal_Dog_index` sub_type := match node.right { @@ -535,9 +535,9 @@ fn (mut g Gen) infix_expr_is_op(node ast.InfixExpr) { } } sub_sym := g.table.sym(sub_type) - g.write('_${sym.cname}_${sub_sym.cname}_index') + g.write('_${left_sym.cname}_${sub_sym.cname}_index') return - } else if sym.kind == .sum_type { + } else if left_sym.kind == .sum_type { g.write('_typ $cmp_op ') } g.expr(node.right)