func NewContext() *Context { importer := importer.NewImporter() ctx := &Context{ allImports: importer.Imports, context: types.Context{ Import: importer.Import, }, } return ctx }
// typeCheck creates a typedPackage from a package_ func typeCheck(p package_) (typedPackage, error) { tp := typedPackage{ package_: p, callTypes: make(map[ast.Expr]types.Type), identObjs: make(map[*ast.Ident]types.Object), } info := types.Info{ Types: tp.callTypes, Objects: tp.identObjs, } context := types.Config{Import: importer.NewImporter().Import} _, err := context.Check(p.path, p.fset, p.astFiles, &info) return tp, err }