From b924c6c4a93a83748b05811c2dc870ccdf4f0aee Mon Sep 17 00:00:00 2001 From: yuyi Date: Sun, 28 Jun 2020 17:35:49 +0800 Subject: [PATCH] cgen: minor opitimize `infix_expr` (#5547) --- vlib/v/gen/cgen.v | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 26ecc709b9..beaea1506a 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -1828,11 +1828,10 @@ fn (mut g Gen) infix_expr(node ast.InfixExpr) { g.expr(node.left) g.write(')') } - } else if node.op == .left_shift && g.table.get_type_symbol(left_type).kind == .array { + } else if node.op == .left_shift && left_sym.kind == .array { // arr << val tmp := g.new_tmp_var() - sym := g.table.get_type_symbol(left_type) - info := sym.info as table.Array + info := left_sym.info as table.Array if right_sym.kind == .array && info.elem_type != node.right_type { // push an array => PUSH_MANY, but not if pushing an array to 2d array (`[][]int << []int`) g.write('_PUSH_MANY(&')