Skip to content

Commit 4414aad

Browse files
jirfagrandall77
authored andcommitted
go/ssa: make a setNumable interface
Workaround crash on go/ssa in go < 1.13. See golang/go#29612. Change-Id: I32687f6ee0baaf223248d5c1631663c73cbbfc65 GitHub-Last-Rev: 6bf28bf GitHub-Pull-Request: #162 Reviewed-on: https://go-review.googlesource.com/c/tools/+/195477 Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent 57610ed commit 4414aad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

go/ssa/func.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ func (f *Function) createSyntacticParams(recv *ast.FieldList, functype *ast.Func
257257
}
258258
}
259259

260+
type setNumable interface {
261+
setNum(int)
262+
}
263+
260264
// numberRegisters assigns numbers to all SSA registers
261265
// (value-defining Instructions) in f, to aid debugging.
262266
// (Non-Instruction Values are named at construction.)
@@ -267,9 +271,7 @@ func numberRegisters(f *Function) {
267271
for _, instr := range b.Instrs {
268272
switch instr.(type) {
269273
case Value:
270-
instr.(interface {
271-
setNum(int)
272-
}).setNum(v)
274+
instr.(setNumable).setNum(v)
273275
v++
274276
}
275277
}

0 commit comments

Comments
 (0)