mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
quick fix for compound assignment operators
a better fix would be to change lot of things inside parser
This commit is contained in:
committed by
Alex Medvednikov
parent
218a46611e
commit
663cbadf60
@@ -1018,10 +1018,15 @@ fn (p mut Parser) assign_statement(v Var, ph int, is_map bool) {
|
||||
if is_str {
|
||||
p.gen('= string_add($v.name, ')// TODO can't do `foo.bar += '!'`
|
||||
}
|
||||
else {
|
||||
else if !is_map {
|
||||
p.gen(' += ')
|
||||
}
|
||||
default: p.gen(' ' + p.tok.str() + ' ')
|
||||
default:
|
||||
if tok != MINUS_ASSIGN && tok != MULT_ASSIGN && tok != XOR_ASSIGN
|
||||
&& tok != MOD_ASSIGN && tok != AND_ASSIGN && tok != OR_ASSIGN
|
||||
&& tok != RIGHT_SHIFT_ASSIGN && tok != LEFT_SHIFT_ASSIGN && tok != DIV_ASSIGN {
|
||||
p.gen(' ' + p.tok.str() + ' ')
|
||||
}
|
||||
}
|
||||
p.fgen(' ' + p.tok.str() + ' ')
|
||||
p.next()
|
||||
|
||||
Reference in New Issue
Block a user