mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
optimize reserved type check
This commit is contained in:
parent
6d98203572
commit
6bcd0fd9cc
@ -22,6 +22,7 @@ fn (p mut Parser) for_st() {
|
|||||||
else if next_tok == .decl_assign || next_tok == .assign || p.tok == .semicolon {
|
else if next_tok == .decl_assign || next_tok == .assign || p.tok == .semicolon {
|
||||||
p.genln('for (')
|
p.genln('for (')
|
||||||
if next_tok == .decl_assign {
|
if next_tok == .decl_assign {
|
||||||
|
p.check_not_reserved()
|
||||||
p.var_decl()
|
p.var_decl()
|
||||||
}
|
}
|
||||||
else if p.tok != .semicolon {
|
else if p.tok != .semicolon {
|
||||||
|
@ -697,7 +697,7 @@ fn (p mut Parser) check_string() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn (p mut Parser) check_not_reserved () {
|
fn (p mut Parser) check_not_reserved () {
|
||||||
if p.lit in Reserved_Types {
|
if Reserved_Types[p.lit] {
|
||||||
p.error('`$p.lit` can\'t be used as name')
|
p.error('`$p.lit` can\'t be used as name')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user