Skip to content

Commit a9667bb

Browse files
committed
fixed name collisions
1 parent 287c95d commit a9667bb

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/linter/block.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -841,10 +841,10 @@ func (b *blockWalker) handleTry(s *ir.TryStmt) bool {
841841
})
842842
}
843843

844-
for nm, types := range varTypes {
844+
for nm, typs := range varTypes {
845845
var flags meta.VarFlags
846846
flags.SetAlwaysDefined(defCounts[nm] == linksCount)
847-
b.ctx.sc.AddVarName(nm, types, "all branches try catch", flags)
847+
b.ctx.sc.AddVarName(nm, typs, "all branches try catch", flags)
848848
}
849849

850850
if finallyCtx != nil {
@@ -1927,10 +1927,10 @@ func (b *blockWalker) handleSwitch(s *ir.SwitchStmt) bool {
19271927
})
19281928
}
19291929

1930-
for nm, types := range varTypes {
1930+
for nm, typs := range varTypes {
19311931
var flags meta.VarFlags
19321932
flags.SetAlwaysDefined(defCounts[nm] == linksCount)
1933-
b.ctx.sc.AddVarName(nm, types, "all cases", flags)
1933+
b.ctx.sc.AddVarName(nm, typs, "all cases", flags)
19341934
}
19351935

19361936
return false

src/linter/report.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,8 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
11941194
}
11951195
}
11961196

1197-
old := reportListToMap(oldList)
1198-
new := reportListToMap(newList)
1197+
oldReportMap := reportListToMap(oldList)
1198+
newReportMap := reportListToMap(newList)
11991199
changes := gitChangesToMap(changesList)
12001200

12011201
var mu sync.Mutex
@@ -1205,7 +1205,7 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
12051205

12061206
limitCh := make(chan struct{}, maxConcurrency)
12071207

1208-
for filename, list := range new {
1208+
for filename, list := range newReportMap {
12091209
wg.Add(1)
12101210
go func(filename string, list []*Report) {
12111211
limitCh <- struct{}{}
@@ -1221,7 +1221,7 @@ func DiffReports(gitRepo string, diffArgs []string, changesList []git.Change, ch
12211221
oldName = filename // full diff mode
12221222
}
12231223

1224-
reports, err := diffReportsList(gitRepo, ignoreCommits, diffArgs, filename, c, old[oldName], list)
1224+
reports, err := diffReportsList(gitRepo, ignoreCommits, diffArgs, filename, c, oldReportMap[oldName], list)
12251225
if err != nil {
12261226
mu.Lock()
12271227
resErr = err
@@ -1275,8 +1275,8 @@ func diffReportsList(gitRepo string, ignoreCommits map[string]struct{}, diffArgs
12751275
}
12761276
}
12771277

1278-
old, oldMaxLine := reportListToPerLineMap(oldList)
1279-
new, newMaxLine := reportListToPerLineMap(newList)
1278+
oldReportMap, oldMaxLine := reportListToPerLineMap(oldList)
1279+
newReportMap, newMaxLine := reportListToPerLineMap(newList)
12801280

12811281
var maxLine = oldMaxLine
12821282
if newMaxLine > maxLine {
@@ -1293,17 +1293,17 @@ func diffReportsList(gitRepo string, ignoreCommits map[string]struct{}, diffArgs
12931293
// just deletion
12941294
if ok && ch.new.HaveRange && ch.new.Range == 0 {
12951295
oldLine = ch.old.To
1296-
newLine-- // cancel the increment of newLine, because code was deleted, no new lines added
1296+
newLine-- // cancel the increment of newLine, because code was deleted, no newReportMap lines added
12971297
continue
12981298
}
12991299

1300-
res = maybeAppendReports(res, new, old, newLine, oldLine, blame, ignoreCommits)
1300+
res = maybeAppendReports(res, newReportMap, oldReportMap, newLine, oldLine, blame, ignoreCommits)
13011301

13021302
if ok {
13031303
oldLine = 0 // all changes and additions must be checked
13041304
for j := newLine + 1; j <= ch.new.To; j++ {
13051305
newLine = j
1306-
res = maybeAppendReports(res, new, old, newLine, oldLine, blame, ignoreCommits)
1306+
res = maybeAppendReports(res, newReportMap, oldReportMap, newLine, oldLine, blame, ignoreCommits)
13071307
}
13081308
oldLine = ch.old.To
13091309
}

0 commit comments

Comments
 (0)