Skip to content

Commit dfc41b5

Browse files
committed
go/ssa: use ast.RangeStmt.Range position directly
ast.RangeStmt.Range has been available since 1.20. Change-Id: Ia3f9b3075d39c6415e20dfdb3151e94fbf11a597 Reviewed-on: https://go-review.googlesource.com/c/tools/+/614458 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 3921b59 commit dfc41b5

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

go/ssa/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2508,7 +2508,7 @@ func (b *builder) rangeFunc(fn *Function, x Value, tk, tv types.Type, rng *ast.R
25082508
name: fmt.Sprintf("%s$%d", fn.Name(), anonIdx+1),
25092509
Signature: ysig,
25102510
Synthetic: "range-over-func yield",
2511-
pos: rangePosition(rng),
2511+
pos: rng.Range,
25122512
parent: fn,
25132513
anonIdx: int32(len(fn.AnonFuncs)),
25142514
Pkg: fn.Pkg,

go/ssa/util.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ func isBlankIdent(e ast.Expr) bool {
4444
return ok && id.Name == "_"
4545
}
4646

47-
// rangePosition is the position to give for the `range` token in a RangeStmt.
48-
var rangePosition = func(rng *ast.RangeStmt) token.Pos {
49-
// Before 1.20, this is unreachable.
50-
// rng.For is a close, but incorrect position.
51-
return rng.For
52-
}
53-
5447
//// Type utilities. Some of these belong in go/types.
5548

5649
// isNonTypeParamInterface reports whether t is an interface type but not a type parameter.

go/ssa/util_go120.go

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)