parser: fix Enum.value when Enum is an imported symbol (#9046)
parent
a1e0f2bc46
commit
4c3ce97763
|
@ -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)
|
||||
|
|
|
@ -15,7 +15,7 @@ fn test_imported_symbols_types() {
|
|||
|
||||
fn test_imported_symbols_functions() {
|
||||
p0 := Point{x: 20 y: 40}
|
||||
// method
|
||||
// method
|
||||
assert p0.str() == '20 40'
|
||||
// function
|
||||
assert point_str(p0) == '20 40'
|
||||
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue