Skip to content

Commit c5cb1d2

Browse files
authored
v2: ./v3 -backend cleanc v2.v no longer segfaults (TODO revert all the temp fixes)
1 parent d549045 commit c5cb1d2

8 files changed

Lines changed: 614 additions & 338 deletions

File tree

‎vlib/v2/gen/arm64/arm64.v‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,13 @@ fn (g &Gen) lookup_type_from_env(name string, module_name string) ?types.Type {
15231523
if g.mod.env == unsafe { nil } {
15241524
return none
15251525
}
1526-
mut scope := lock g.mod.env.scopes {
1527-
g.mod.env.scopes[module_name] or { g.mod.env.scopes['builtin'] or { return none } }
1526+
mut scope := &types.Scope(unsafe { nil })
1527+
if s := g.mod.env.get_scope(module_name) {
1528+
scope = s
1529+
} else if s := g.mod.env.get_scope('builtin') {
1530+
scope = s
1531+
} else {
1532+
return none
15281533
}
15291534
if obj := scope.lookup_parent(name, 0) {
15301535
if obj is types.Type {

0 commit comments

Comments
 (0)