parser: fix Enum.value when Enum is an imported symbol (#9046)

pull/9189/head
zakuro 2021-03-08 00:44:38 +09:00 committed by GitHub
parent a1e0f2bc46
commit 4c3ce97763
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -1391,7 +1391,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
if mod != '' {
enum_name = mod + '.' + enum_name
} else {
enum_name = p.prepend_mod(enum_name)
enum_name = p.imported_symbols[enum_name] or { p.prepend_mod(enum_name) }
}
// p.warn('Color.green $enum_name ' + p.prepend_mod(enum_name) + 'mod=$mod')
p.check(.dot)

View File

@ -35,4 +35,5 @@ fn vertex_count(s Shape) int {
fn test_imported_symbols_enums() {
assert vertex_count(.triangle) == 3
assert vertex_count(Shape.triangle) == 3
}