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

x64, v2 backends

This commit is contained in:
Alexander Medvednikov
2019-12-30 20:02:54 +01:00
parent 907254b9e8
commit 81ae54d9bd
21 changed files with 901 additions and 74 deletions

View File

@ -356,6 +356,7 @@ fn (p mut Parser) name_expr() string {
}
// Color.green
else if p.peek() == .dot {
is_arr_start := p.prev_tok == .lsbr
enum_type := p.table.find_type(name)
if enum_type.cat != .enum_ {
p.error('`$name` is not an enum')
@ -366,7 +367,7 @@ fn (p mut Parser) name_expr() string {
if !enum_type.has_enum_val(val) {
p.error('enum `$enum_type.name` does not have value `$val`')
}
if p.expected_type == enum_type.name {
if p.expected_type == enum_type.name && !is_arr_start {
// `if color == .red` is enough
// no need in `if color == Color.red`
p.warn('`${enum_type.name}.$val` is unnecessary, use `.$val`')