File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -369,7 +369,12 @@ func (c *funcContext) handleEscapingVars(n ast.Node) {
369
369
370
370
var names []string
371
371
objs := analysis .EscapingObjects (n , c .p .Info .Info )
372
- sort .Sort (varsByName (objs ))
372
+ sort .Slice (objs , func (i , j int ) bool {
373
+ if objs [i ].Name () == objs [j ].Name () {
374
+ return objs [i ].Pos () < objs [j ].Pos ()
375
+ }
376
+ return objs [i ].Name () < objs [j ].Name ()
377
+ })
373
378
for _ , obj := range objs {
374
379
names = append (names , c .objectName (obj ))
375
380
c .p .escapingVars [obj ] = true
@@ -638,17 +643,3 @@ func endsWithReturn(stmts []ast.Stmt) bool {
638
643
func encodeIdent (name string ) string {
639
644
return strings .Replace (url .QueryEscape (name ), "%" , "$" , - 1 )
640
645
}
641
-
642
- type varsByName []* types.Var
643
-
644
- func (s varsByName ) Len () int {
645
- return len (s )
646
- }
647
-
648
- func (s varsByName ) Swap (i , j int ) {
649
- s [i ], s [j ] = s [j ], s [i ]
650
- }
651
-
652
- func (s varsByName ) Less (i , j int ) bool {
653
- return s [i ].Name () < s [j ].Name ()
654
- }
You can’t perform that action at this time.
0 commit comments