Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 6, 2024
1 parent 1f242d1 commit 98a04af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions vlib/v/parser/expr.v
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,10 @@ fn (mut p Parser) expr_with_left(left ast.Expr, precedence int, is_stmt_ident bo
tok := p.tok
mut pos := tok.pos()
p.next()
old_assign_rhs := p.inside_assign_rhs
p.inside_assign_rhs = true
right := p.expr(precedence - 1)
p.inside_assign_rhs = old_assign_rhs
pos.update_last_line(p.prev_tok.line_nr)
if mut node is ast.IndexExpr {
node.recursive_arraymap_set_is_setter()
Expand Down Expand Up @@ -778,7 +781,10 @@ fn (mut p Parser) infix_expr(left ast.Expr) ast.Expr {
}

right_op_pos := p.tok.pos()
old_assign_rhs := p.inside_assign_rhs
p.inside_assign_rhs = true
right = p.expr(precedence)
p.inside_assign_rhs = old_assign_rhs
if op in [.plus, .minus, .mul, .div, .mod, .lt, .eq] && mut right is ast.PrefixExpr {
mut right_expr := right.right
for mut right_expr is ast.ParExpr {
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/parser/parser.v
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,7 @@ fn (mut p Parser) parse_multi_expr(is_top_level bool) ast.Stmt {
mut defer_vars := p.defer_vars.clone()
p.defer_vars = []ast.Ident{}

left := p.expr_list(false)
left := p.expr_list(p.inside_assign_rhs)

if !(p.inside_defer && p.tok.kind == .decl_assign) {
defer_vars << p.defer_vars
Expand Down

0 comments on commit 98a04af

Please sign in to comment.