1
0
mirror of https://github.com/golang/go synced 2024-09-24 05:10:13 -06:00

[dev.typeparams] cmd/compile/internal/gc: provide types2 selection info to noder

Change-Id: I231e3a1c9f663e2a63c0ad73d571c7a00005f50b
Reviewed-on: https://go-review.googlesource.com/c/go/+/278092
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Robert Griesemer 2020-12-14 16:07:05 -08:00
parent c8e73489c3
commit 5aff757efc

View File

@ -114,9 +114,10 @@ func parseFiles(filenames []string) (lines uint) {
},
}
info := types2.Info{
Types: make(map[syntax.Expr]types2.TypeAndValue),
Defs: make(map[*syntax.Name]types2.Object),
Uses: make(map[*syntax.Name]types2.Object),
Types: make(map[syntax.Expr]types2.TypeAndValue),
Defs: make(map[*syntax.Name]types2.Object),
Uses: make(map[*syntax.Name]types2.Object),
Selections: make(map[*syntax.SelectorExpr]*types2.Selection),
// expand as needed
}
conf.Check(base.Ctxt.Pkgpath, files, &info)
@ -283,6 +284,11 @@ func (p *noder) use(x *syntax.Name) types2.Object {
return p.typeInfo.Uses[x]
}
// sel returns the selection information for the given selector expression.
func (p *noder) sel(x *syntax.SelectorExpr) *types2.Selection {
return p.typeInfo.Selections[x]
}
func (p *noder) funcBody(fn *ir.Func, block *syntax.BlockStmt) {
oldScope := p.scope
p.scope = 0