mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +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:
parent
218a46611e
commit
663cbadf60
2 changed files with 29 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue