Skip to content

Commit 95054d8

Browse files
committed
removed Archive.types field
1 parent f8510c9 commit 95054d8

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

compiler/compiler.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ type Archive struct {
4040
IncJSCode []byte
4141
FileSet []byte
4242
Minified bool
43-
44-
types *types.Package
4543
}
4644

4745
type Decl struct {
@@ -241,11 +239,10 @@ func ReadArchive(filename, path string, r io.Reader, packages map[string]*types.
241239
}
242240

243241
var err error
244-
_, a.types, err = importer.ImportData(packages, a.ExportData)
242+
_, packages[path], err = importer.ImportData(packages, a.ExportData)
245243
if err != nil {
246244
return nil, err
247245
}
248-
packages[path] = a.types
249246

250247
return &a, nil
251248
}

compiler/package.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func (pi packageImporter) Import(path string) (*types.Package, error) {
114114
return nil, err
115115
}
116116

117-
return a.types, nil
117+
return pi.importContext.Packages[a.ImportPath], nil
118118
}
119119

120120
func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, importContext *ImportContext, minify bool) (*Archive, error) {
@@ -530,7 +530,6 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
530530
Declarations: allDecls,
531531
FileSet: encodedFileSet.Bytes(),
532532
Minified: minify,
533-
types: typesPkg,
534533
}, nil
535534
}
536535

0 commit comments

Comments
 (0)