mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v2: make array append <<
right associative
This commit is contained in:
parent
147ecc5e17
commit
063ca3b644
@ -828,6 +828,19 @@ pub fn (p mut Parser) expr(precedence int) (ast.Expr,table.Type) {
|
||||
typ: typ
|
||||
}
|
||||
}
|
||||
// `arr << 'a'` | `arr << 'a' + 'b'`
|
||||
else if p.tok.kind == .left_shift {
|
||||
tok := p.tok
|
||||
p.next()
|
||||
mut right := ast.Expr{}
|
||||
right, typ = p.expr(precedence-1)
|
||||
node = ast.InfixExpr{
|
||||
left: node
|
||||
right: right
|
||||
op: tok.kind
|
||||
pos: tok.position()
|
||||
}
|
||||
}
|
||||
else if p.tok.kind.is_infix() {
|
||||
node,typ = p.infix_expr(node)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user