mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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
6 changed files with 13 additions and 13 deletions
|
|
@ -660,7 +660,7 @@ func (r *importReader) doType(base *types2.Named) types2.Type {
|
||||||
baseType := r.typ()
|
baseType := r.typ()
|
||||||
// The imported instantiated type doesn't include any methods, so
|
// The imported instantiated type doesn't include any methods, so
|
||||||
// we must always use the methods of the base (orig) type.
|
// 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)
|
t, _ := types2.Instantiate(nil, baseType, targs, false)
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ var newReadImportFunc = func(data string, pkg1 *types.Pkg, env *types2.Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
type gcimports struct {
|
type gcimports struct {
|
||||||
env *types2.Context
|
ctxt *types2.Context
|
||||||
packages map[string]*types2.Package
|
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")
|
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
|
return pkg, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,13 +34,13 @@ func checkFiles(noders []*noder) (posMap, *types2.Package, *types2.Info) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// typechecking
|
// typechecking
|
||||||
env := types2.NewContext()
|
ctxt := types2.NewContext()
|
||||||
importer := gcimports{
|
importer := gcimports{
|
||||||
env: env,
|
ctxt: ctxt,
|
||||||
packages: map[string]*types2.Package{"unsafe": types2.Unsafe},
|
packages: map[string]*types2.Package{"unsafe": types2.Unsafe},
|
||||||
}
|
}
|
||||||
conf := types2.Config{
|
conf := types2.Config{
|
||||||
Context: env,
|
Context: ctxt,
|
||||||
GoVersion: base.Flag.Lang,
|
GoVersion: base.Flag.Lang,
|
||||||
IgnoreLabels: true, // parser already checked via syntax.CheckBranches mode
|
IgnoreLabels: true, // parser already checked via syntax.CheckBranches mode
|
||||||
CompilerErrorMessages: true, // use error strings matching existing compiler errors
|
CompilerErrorMessages: true, // use error strings matching existing compiler errors
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import (
|
||||||
type pkgReader2 struct {
|
type pkgReader2 struct {
|
||||||
pkgDecoder
|
pkgDecoder
|
||||||
|
|
||||||
env *types2.Context
|
ctxt *types2.Context
|
||||||
imports map[string]*types2.Package
|
imports map[string]*types2.Package
|
||||||
|
|
||||||
posBases []*syntax.PosBase
|
posBases []*syntax.PosBase
|
||||||
|
|
@ -24,11 +24,11 @@ type pkgReader2 struct {
|
||||||
typs []types2.Type
|
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{
|
pr := pkgReader2{
|
||||||
pkgDecoder: input,
|
pkgDecoder: input,
|
||||||
|
|
||||||
env: env,
|
ctxt: ctxt,
|
||||||
imports: imports,
|
imports: imports,
|
||||||
|
|
||||||
posBases: make([]*syntax.PosBase, input.numElems(relocPosBase)),
|
posBases: make([]*syntax.PosBase, input.numElems(relocPosBase)),
|
||||||
|
|
@ -231,7 +231,7 @@ func (r *reader2) doTyp() (res types2.Type) {
|
||||||
obj, targs := r.obj()
|
obj, targs := r.obj()
|
||||||
name := obj.(*types2.TypeName)
|
name := obj.(*types2.TypeName)
|
||||||
if len(targs) != 0 {
|
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 t
|
||||||
}
|
}
|
||||||
return name.Type()
|
return name.Type()
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,12 @@ func unified(noders []*noder) {
|
||||||
base.Errorf("cannot use -G and -d=quirksmode together")
|
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)
|
pr := newPkgDecoder(pkg1.Path, data)
|
||||||
|
|
||||||
// Read package descriptors for both types2 and compiler backend.
|
// Read package descriptors for both types2 and compiler backend.
|
||||||
readPackage(newPkgReader(pr), pkg1)
|
readPackage(newPkgReader(pr), pkg1)
|
||||||
pkg2 = readPackage2(env, packages, pr)
|
pkg2 = readPackage2(ctxt, packages, pr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -652,7 +652,7 @@ func (r *importReader) doType(base *types.Named) types.Type {
|
||||||
baseType := r.typ()
|
baseType := r.typ()
|
||||||
// The imported instantiated type doesn't include any methods, so
|
// The imported instantiated type doesn't include any methods, so
|
||||||
// we must always use the methods of the base (orig) type.
|
// 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)
|
t, _ := types.Instantiate(nil, baseType, targs, false)
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue