@@ -220,15 +220,15 @@ func run(pass *analysis.Pass) (any, error) {
220
220
case * ast.Ident :
221
221
// If the identifier is a use of an inlinable constant, suggest inlining it.
222
222
if con , ok := pass .TypesInfo .Uses [n ].(* types.Const ); ok {
223
- fcon , ok := inlinableConsts [con ]
223
+ incon , ok := inlinableConsts [con ]
224
224
if ! ok {
225
225
var fact goFixInlineConstFact
226
226
if pass .ImportObjectFact (con , & fact ) {
227
- fcon = & fact
228
- inlinableConsts [con ] = fcon
227
+ incon = & fact
228
+ inlinableConsts [con ] = incon
229
229
}
230
230
}
231
- if fcon == nil {
231
+ if incon == nil {
232
232
continue // nope
233
233
}
234
234
@@ -248,30 +248,30 @@ func run(pass *analysis.Pass) (any, error) {
248
248
// If the RHS is not in the current package, AddImport will handle
249
249
// shadowing, so we only need to worry about when both expressions
250
250
// are in the current package.
251
- if pass .Pkg .Path () == fcon .RHSPkgPath {
251
+ if pass .Pkg .Path () == incon .RHSPkgPath {
252
252
// fcon.rhsObj is the object referred to by B in the definition of A.
253
253
scope := pass .TypesInfo .Scopes [curFile ].Innermost (n .Pos ()) // n's scope
254
- _ , obj := scope .LookupParent (fcon .RHSName , n .Pos ()) // what "B" means in n's scope
254
+ _ , obj := scope .LookupParent (incon .RHSName , n .Pos ()) // what "B" means in n's scope
255
255
if obj == nil {
256
256
// Should be impossible: if code at n can refer to the LHS,
257
257
// it can refer to the RHS.
258
- panic (fmt .Sprintf ("no object for inlinable const %s RHS %s" , n .Name , fcon .RHSName ))
258
+ panic (fmt .Sprintf ("no object for inlinable const %s RHS %s" , n .Name , incon .RHSName ))
259
259
}
260
- if obj != fcon .rhsObj {
260
+ if obj != incon .rhsObj {
261
261
// "B" means something different here than at the inlinable const's scope.
262
262
continue
263
263
}
264
- } else if ! analysisinternal .CanImport (pass .Pkg .Path (), fcon .RHSPkgPath ) {
264
+ } else if ! analysisinternal .CanImport (pass .Pkg .Path (), incon .RHSPkgPath ) {
265
265
// If this package can't see the RHS's package, we can't inline.
266
266
continue
267
267
}
268
268
var (
269
269
importPrefix string
270
270
edits []analysis.TextEdit
271
271
)
272
- if fcon .RHSPkgPath != pass .Pkg .Path () {
272
+ if incon .RHSPkgPath != pass .Pkg .Path () {
273
273
_ , importPrefix , edits = analysisinternal .AddImport (
274
- pass .TypesInfo , curFile , fcon .RHSPkgName , fcon .RHSPkgPath , fcon .RHSName , n .Pos ())
274
+ pass .TypesInfo , curFile , incon .RHSPkgName , incon .RHSPkgPath , incon .RHSName , n .Pos ())
275
275
}
276
276
var (
277
277
pos = n .Pos ()
@@ -287,7 +287,7 @@ func run(pass *analysis.Pass) (any, error) {
287
287
edits = append (edits , analysis.TextEdit {
288
288
Pos : pos ,
289
289
End : end ,
290
- NewText : []byte (importPrefix + fcon .RHSName ),
290
+ NewText : []byte (importPrefix + incon .RHSName ),
291
291
})
292
292
pass .Report (analysis.Diagnostic {
293
293
Pos : pos ,
0 commit comments