V: fix const bugs and pass const_test.v (#4206)

* fix const bug in v2

* v2: fix const decl

* small comment fix
This commit is contained in:
hazohelet 2020-04-03 02:39:17 +09:00 committed by GitHub
parent 6309e699e5
commit 0e6fe0a4f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 9 deletions

View file

@ -1440,6 +1440,7 @@ fn (p mut Parser) const_decl() ast.ConstDecl {
if is_pub {
p.next()
}
pos := p.tok.position()
p.check(.key_const)
p.check(.lpar)
mut fields := []ast.Field
@ -1463,6 +1464,7 @@ fn (p mut Parser) const_decl() ast.ConstDecl {
}
p.check(.rpar)
return ast.ConstDecl{
pos : pos
fields: fields
exprs: exprs
is_pub: is_pub