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

make enums defined in other modules work

This commit is contained in:
Alexander Medvednikov 2019-07-14 00:10:39 +02:00
parent 5dfd5fa3e7
commit 48f841bb26

View File

@ -1296,7 +1296,7 @@ fn (p mut Parser) name_expr() string {
if !T.has_enum_val(val) {
p.error('enum `$T.name` does not have value `$val`')
}
p.gen(p.mod + '__' + p.expected_type + '_' + val)
p.gen(T.mod + '__' + p.expected_type + '_' + val)
}
return p.expected_type
}
@ -1375,7 +1375,7 @@ fn (p mut Parser) name_expr() string {
p.check(.dot)
val := p.lit
// println('enum val $val')
p.gen(p.mod + '__' + enum_type.name + '_' + val)// `color = main__Color_green`
p.gen(enum_type.mod + '__' + enum_type.name + '_' + val)// `color = main__Color_green`
p.next()
return enum_type.name
}