parser: do not allow fn consts

pull/6651/head
Alexander Medvednikov 2020-10-19 13:48:39 +02:00
parent 0d31b39f11
commit 37d6503437
1 changed files with 3 additions and 0 deletions

View File

@ -1626,6 +1626,9 @@ fn (mut p Parser) const_decl() ast.ConstDecl {
// name := p.check_name()
// println('!!const: $name')
p.check(.assign)
if p.tok.kind == .key_fn {
p.error('const initializer fn literal is not a constant')
}
expr := p.expr(0)
field := ast.ConstField{
name: full_name