Skip to content

Commit 3b0b264

Browse files
committed
internal/refactor: handle qualified names in inlined assignments
Rewrite our call site processing of imports, to simplify, and so that we can re-use the import lookup logic in the assignStmts strategy for the purpose of writing out types. A large TODO is included for a hypothetical refactoring of the inlining logic that could formalize these types of interactions between call site analysis and inlining strategy. Fixes golang/go#65217 Change-Id: Ifd99ea14430deba3a03cdfb936b6edee9e81d0bf Reviewed-on: https://go-review.googlesource.com/c/tools/+/629435 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 9311800 commit 3b0b264

File tree

3 files changed

+303
-79
lines changed

3 files changed

+303
-79
lines changed

internal/refactor/inline/callee.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,19 @@ func AnalyzeCallee(logf func(string, ...any), fset *token.FileSet, pkg *types.Pa
202202
objidx, ok := freeObjIndex[obj]
203203
if !ok {
204204
objidx = len(freeObjIndex)
205-
var pkgpath, pkgname string
205+
var pkgPath, pkgName string
206206
if pn, ok := obj.(*types.PkgName); ok {
207-
pkgpath = pn.Imported().Path()
208-
pkgname = pn.Imported().Name()
207+
pkgPath = pn.Imported().Path()
208+
pkgName = pn.Imported().Name()
209209
} else if obj.Pkg() != nil {
210-
pkgpath = obj.Pkg().Path()
211-
pkgname = obj.Pkg().Name()
210+
pkgPath = obj.Pkg().Path()
211+
pkgName = obj.Pkg().Name()
212212
}
213213
freeObjs = append(freeObjs, object{
214214
Name: obj.Name(),
215215
Kind: objectKind(obj),
216-
PkgName: pkgname,
217-
PkgPath: pkgpath,
216+
PkgName: pkgName,
217+
PkgPath: pkgPath,
218218
ValidPos: obj.Pos().IsValid(),
219219
})
220220
freeObjIndex[obj] = objidx

0 commit comments

Comments
 (0)