Skip to content

Commit 1c53158

Browse files
committed
avoid recording unused type scopes
1 parent 61b1b1d commit 1c53158

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

internal/packages/load.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,13 @@ func loadPackageEx(dedup Deduper, ld *loader, lpkg *loaderPackage) {
359359
smallCap = 4
360360
}
361361
lpkg.TypesInfo = &types.Info{
362-
Types: make(map[ast.Expr]types.TypeAndValue, typeInfoCap),
363-
Defs: make(map[*ast.Ident]types.Object, identCap),
364-
Uses: make(map[*ast.Ident]types.Object, identCap),
365-
Implicits: make(map[ast.Node]types.Object, smallCap),
366-
Instances: make(map[*ast.Ident]types.Instance, smallCap),
367-
Scopes: make(map[ast.Node]*types.Scope, smallCap),
362+
Types: make(map[ast.Expr]types.TypeAndValue, typeInfoCap),
363+
Defs: make(map[*ast.Ident]types.Object, identCap),
364+
Uses: make(map[*ast.Ident]types.Object, identCap),
365+
Implicits: make(map[ast.Node]types.Object, smallCap),
366+
Instances: make(map[*ast.Ident]types.Instance, smallCap),
367+
// Scopes are not consumed by LLGo or x/tools/go/ssa during compilation.
368+
// Leaving it nil avoids recording every lexical scope during type checking.
368369
Selections: make(map[*ast.SelectorExpr]*types.Selection, smallCap),
369370
}
370371
lpkg.TypesSizes = ld.sizes

0 commit comments

Comments
 (0)