mirror of
https://github.com/golang/go
synced 2024-11-17 05:35:00 -07:00
cmd/compile: rename some types2.Context variables from env to ctxt
Rename some variables in the compiler that were missed in CL 353089. Change-Id: Ie748fe9b64e584a841d08ff60c439c93aae412d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/353149 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
a9d5ea650b
commit
e48cf0db4e
@ -660,7 +660,7 @@ func (r *importReader) doType(base *types2.Named) types2.Type {
|
||||
baseType := r.typ()
|
||||
// The imported instantiated type doesn't include any methods, so
|
||||
// we must always use the methods of the base (orig) type.
|
||||
// TODO provide a non-nil *Environment
|
||||
// TODO provide a non-nil *Context
|
||||
t, _ := types2.Instantiate(nil, baseType, targs, false)
|
||||
return t
|
||||
|
||||
|
@ -48,7 +48,7 @@ var newReadImportFunc = func(data string, pkg1 *types.Pkg, env *types2.Context,
|
||||
}
|
||||
|
||||
type gcimports struct {
|
||||
env *types2.Context
|
||||
ctxt *types2.Context
|
||||
packages map[string]*types2.Package
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ func (m *gcimports) ImportFrom(path, srcDir string, mode types2.ImportMode) (*ty
|
||||
panic("mode must be 0")
|
||||
}
|
||||
|
||||
_, pkg, err := readImportFile(path, typecheck.Target, m.env, m.packages)
|
||||
_, pkg, err := readImportFile(path, typecheck.Target, m.ctxt, m.packages)
|
||||
return pkg, err
|
||||
}
|
||||
|
||||
|
@ -34,13 +34,13 @@ func checkFiles(noders []*noder) (posMap, *types2.Package, *types2.Info) {
|
||||
}
|
||||
|
||||
// typechecking
|
||||
env := types2.NewContext()
|
||||
ctxt := types2.NewContext()
|
||||
importer := gcimports{
|
||||
env: env,
|
||||
ctxt: ctxt,
|
||||
packages: map[string]*types2.Package{"unsafe": types2.Unsafe},
|
||||
}
|
||||
conf := types2.Config{
|
||||
Context: env,
|
||||
Context: ctxt,
|
||||
GoVersion: base.Flag.Lang,
|
||||
IgnoreLabels: true, // parser already checked via syntax.CheckBranches mode
|
||||
CompilerErrorMessages: true, // use error strings matching existing compiler errors
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
type pkgReader2 struct {
|
||||
pkgDecoder
|
||||
|
||||
env *types2.Context
|
||||
ctxt *types2.Context
|
||||
imports map[string]*types2.Package
|
||||
|
||||
posBases []*syntax.PosBase
|
||||
@ -24,11 +24,11 @@ type pkgReader2 struct {
|
||||
typs []types2.Type
|
||||
}
|
||||
|
||||
func readPackage2(env *types2.Context, imports map[string]*types2.Package, input pkgDecoder) *types2.Package {
|
||||
func readPackage2(ctxt *types2.Context, imports map[string]*types2.Package, input pkgDecoder) *types2.Package {
|
||||
pr := pkgReader2{
|
||||
pkgDecoder: input,
|
||||
|
||||
env: env,
|
||||
ctxt: ctxt,
|
||||
imports: imports,
|
||||
|
||||
posBases: make([]*syntax.PosBase, input.numElems(relocPosBase)),
|
||||
@ -231,7 +231,7 @@ func (r *reader2) doTyp() (res types2.Type) {
|
||||
obj, targs := r.obj()
|
||||
name := obj.(*types2.TypeName)
|
||||
if len(targs) != 0 {
|
||||
t, _ := types2.Instantiate(r.p.env, name.Type(), targs, false)
|
||||
t, _ := types2.Instantiate(r.p.ctxt, name.Type(), targs, false)
|
||||
return t
|
||||
}
|
||||
return name.Type()
|
||||
|
@ -78,12 +78,12 @@ func unified(noders []*noder) {
|
||||
base.Errorf("cannot use -G and -d=quirksmode together")
|
||||
}
|
||||
|
||||
newReadImportFunc = func(data string, pkg1 *types.Pkg, env *types2.Context, packages map[string]*types2.Package) (pkg2 *types2.Package, err error) {
|
||||
newReadImportFunc = func(data string, pkg1 *types.Pkg, ctxt *types2.Context, packages map[string]*types2.Package) (pkg2 *types2.Package, err error) {
|
||||
pr := newPkgDecoder(pkg1.Path, data)
|
||||
|
||||
// Read package descriptors for both types2 and compiler backend.
|
||||
readPackage(newPkgReader(pr), pkg1)
|
||||
pkg2 = readPackage2(env, packages, pr)
|
||||
pkg2 = readPackage2(ctxt, packages, pr)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -652,7 +652,7 @@ func (r *importReader) doType(base *types.Named) types.Type {
|
||||
baseType := r.typ()
|
||||
// The imported instantiated type doesn't include any methods, so
|
||||
// we must always use the methods of the base (orig) type.
|
||||
// TODO provide a non-nil *Environment
|
||||
// TODO provide a non-nil *Context
|
||||
t, _ := types.Instantiate(nil, baseType, targs, false)
|
||||
return t
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user