Skip to content

Commit d60db54

Browse files
committed
replaced gcexporter by golang.org/x/tools/go/importer
1 parent d5efe76 commit d60db54

File tree

3 files changed

+6
-235
lines changed

3 files changed

+6
-235
lines changed

compiler/compiler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"strings"
1212

1313
"github.com/gopherjs/gopherjs/compiler/prelude"
14-
"golang.org/x/tools/go/gcimporter"
14+
"golang.org/x/tools/go/importer"
1515
"golang.org/x/tools/go/types"
1616
)
1717

@@ -35,7 +35,7 @@ type Archive struct {
3535
ImportPath string
3636
Name string
3737
Imports []string
38-
GcData []byte
38+
ExportData []byte
3939
Declarations []*Decl
4040
FileSet []byte
4141
Minified bool
@@ -226,7 +226,7 @@ func ReadArchive(filename, path string, r io.Reader, packages map[string]*types.
226226
}
227227

228228
var err error
229-
a.types, err = gcimporter.ImportData(packages, filename, path, bytes.NewReader(a.GcData))
229+
_, a.types, err = importer.ImportData(packages, a.ExportData)
230230
if err != nil {
231231
return nil, err
232232
}

compiler/package.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111

1212
"github.com/gopherjs/gopherjs/compiler/analysis"
13-
"github.com/gopherjs/gopherjs/gcexporter"
13+
"golang.org/x/tools/go/importer"
1414
"golang.org/x/tools/go/types"
1515
"golang.org/x/tools/go/types/typeutil"
1616
)
@@ -118,8 +118,7 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
118118
}
119119
importContext.Packages[importPath] = typesPkg
120120

121-
gcData := bytes.NewBuffer(nil)
122-
gcexporter.Write(typesPkg, gcData, sizes32)
121+
exportData := importer.ExportData(typesPkg)
123122
encodedFileSet := bytes.NewBuffer(nil)
124123
if err := fileSet.Write(json.NewEncoder(encodedFileSet).Encode); err != nil {
125124
return nil, err
@@ -464,7 +463,7 @@ func Compile(importPath string, files []*ast.File, fileSet *token.FileSet, impor
464463
ImportPath: importPath,
465464
Name: typesPkg.Name(),
466465
Imports: importedPaths,
467-
GcData: gcData.Bytes(),
466+
ExportData: exportData,
468467
Declarations: allDecls,
469468
FileSet: encodedFileSet.Bytes(),
470469
Minified: minify,

gcexporter/gcexporter.go

Lines changed: 0 additions & 228 deletions
This file was deleted.

0 commit comments

Comments
 (0)