forked from mirror/enumer
fixed importer
This commit is contained in:
parent
3d7dacca3a
commit
8bdc3a85b5
|
@ -64,7 +64,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/ast"
|
"go/ast"
|
||||||
"go/build"
|
"go/build"
|
||||||
|
exact "go/constant"
|
||||||
"go/format"
|
"go/format"
|
||||||
|
"go/importer"
|
||||||
"go/parser"
|
"go/parser"
|
||||||
"go/token"
|
"go/token"
|
||||||
"go/types"
|
"go/types"
|
||||||
|
@ -74,10 +76,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
exact "go/constant"
|
|
||||||
|
|
||||||
_ "go/importer"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -270,7 +268,7 @@ func (g *Generator) parsePackage(directory string, names []string, text interfac
|
||||||
// check type-checks the package. The package must be OK to proceed.
|
// check type-checks the package. The package must be OK to proceed.
|
||||||
func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) {
|
func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) {
|
||||||
pkg.defs = make(map[*ast.Ident]types.Object)
|
pkg.defs = make(map[*ast.Ident]types.Object)
|
||||||
config := types.Config{FakeImportC: true}
|
config := types.Config{Importer: importer.Default(), FakeImportC: true}
|
||||||
info := &types.Info{
|
info := &types.Info{
|
||||||
Defs: pkg.defs,
|
Defs: pkg.defs,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue