mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
go/types, types2: replace 2 uses of Scope.LookupParent with Checker.lookup
A step towards removing reliance on Scope.LookupParent. Updates #69673. Change-Id: I9fdd4b08ea600b531b90895ac779fdc580ff00e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/616259 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
5fe3b31cf8
commit
de46eaadb5
2 changed files with 4 additions and 4 deletions
|
|
@ -701,7 +701,7 @@ func (check *Checker) selector(x *operand, e *syntax.SelectorExpr, def *TypeName
|
|||
for _, prefix := range cgoPrefixes {
|
||||
// cgo objects are part of the current package (in file
|
||||
// _cgo_gotypes.go). Use regular lookup.
|
||||
_, exp = check.scope.LookupParent(prefix+sel, check.pos)
|
||||
exp = check.lookup(prefix + sel)
|
||||
if exp != nil {
|
||||
break
|
||||
}
|
||||
|
|
@ -963,7 +963,7 @@ func (check *Checker) use1(e syntax.Expr, lhs bool) bool {
|
|||
var v *Var
|
||||
var v_used bool
|
||||
if lhs {
|
||||
if _, obj := check.scope.LookupParent(n.Value, nopos); obj != nil {
|
||||
if obj := check.lookup(n.Value); obj != nil {
|
||||
// It's ok to mark non-local variables, but ignore variables
|
||||
// from other packages to avoid potential race conditions with
|
||||
// dot-imported variables.
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ func (check *Checker) selector(x *operand, e *ast.SelectorExpr, def *TypeName, w
|
|||
for _, prefix := range cgoPrefixes {
|
||||
// cgo objects are part of the current package (in file
|
||||
// _cgo_gotypes.go). Use regular lookup.
|
||||
_, exp = check.scope.LookupParent(prefix+sel, check.pos)
|
||||
exp = check.lookup(prefix + sel)
|
||||
if exp != nil {
|
||||
break
|
||||
}
|
||||
|
|
@ -1012,7 +1012,7 @@ func (check *Checker) use1(e ast.Expr, lhs bool) bool {
|
|||
var v *Var
|
||||
var v_used bool
|
||||
if lhs {
|
||||
if _, obj := check.scope.LookupParent(n.Name, nopos); obj != nil {
|
||||
if obj := check.lookup(n.Name); obj != nil {
|
||||
// It's ok to mark non-local variables, but ignore variables
|
||||
// from other packages to avoid potential race conditions with
|
||||
// dot-imported variables.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue