File tree Expand file tree Collapse file tree 3 files changed +42
-8
lines changed Expand file tree Collapse file tree 3 files changed +42
-8
lines changed Original file line number Diff line number Diff line change @@ -121,14 +121,7 @@ func (lp *loadingPackage) loadFromSource(loadMode LoadMode) error {
121121
122122 pkg .IllTyped = true
123123
124- pkg .TypesInfo = & types.Info {
125- Types : make (map [ast.Expr ]types.TypeAndValue ),
126- Defs : make (map [* ast.Ident ]types.Object ),
127- Uses : make (map [* ast.Ident ]types.Object ),
128- Implicits : make (map [ast.Node ]types.Object ),
129- Scopes : make (map [ast.Node ]* types.Scope ),
130- Selections : make (map [* ast.SelectorExpr ]* types.Selection ),
131- }
124+ pkg .TypesInfo = newTypesInfo ()
132125
133126 importer := func (path string ) (* types.Package , error ) {
134127 if path == unsafePkgName {
Original file line number Diff line number Diff line change 1+ //go:build go1.18
2+ // +build go1.18
3+
4+ package goanalysis
5+
6+ import (
7+ "go/ast"
8+ "go/types"
9+ )
10+
11+ func newTypesInfo () * types.Info {
12+ return & types.Info {
13+ Types : make (map [ast.Expr ]types.TypeAndValue ),
14+ Instances : make (map [* ast.Ident ]types.Instance ),
15+ Defs : make (map [* ast.Ident ]types.Object ),
16+ Uses : make (map [* ast.Ident ]types.Object ),
17+ Implicits : make (map [ast.Node ]types.Object ),
18+ Scopes : make (map [ast.Node ]* types.Scope ),
19+ Selections : make (map [* ast.SelectorExpr ]* types.Selection ),
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ //go:build go1.17 && !go1.18
2+ // +build go1.17,!go1.18
3+
4+ package goanalysis
5+
6+ import (
7+ "go/ast"
8+ "go/types"
9+ )
10+
11+ func newTypesInfo () * types.Info {
12+ return & types.Info {
13+ Types : make (map [ast.Expr ]types.TypeAndValue ),
14+ Defs : make (map [* ast.Ident ]types.Object ),
15+ Uses : make (map [* ast.Ident ]types.Object ),
16+ Implicits : make (map [ast.Node ]types.Object ),
17+ Scopes : make (map [ast.Node ]* types.Scope ),
18+ Selections : make (map [* ast.SelectorExpr ]* types.Selection ),
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments