1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: assoc

This commit is contained in:
Alexander Medvednikov
2020-03-19 08:14:09 +01:00
parent 3dc3b11435
commit 28309da1f1
3 changed files with 29 additions and 1 deletions

View File

@@ -790,6 +790,10 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
}
else {
name := p.check_name()
var := p.scope.find_var(name) or {
p.error('unknown variable `$name`')
return node
}
mut fields := []string
mut vals := []ast.Expr
p.check(.pipe)
@@ -810,6 +814,7 @@ pub fn (p mut Parser) expr(precedence int) ast.Expr {
fields: fields
exprs: vals
pos: p.tok.position()
typ: var.typ
}
}
p.check(.rcbr)