go/ssa: make a setNumable interface
Workaround crash on go/ssa in go < 1.13.
See https://github.com/golang/go/issues/29612.
Change-Id: I32687f6ee0baaf223248d5c1631663c73cbbfc65
GitHub-Last-Rev: 6bf28bf927cff6d53bcfaf199701e5451d17305e
GitHub-Pull-Request: golang/tools#162
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195477
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
diff --git a/go/ssa/func.go b/go/ssa/func.go
index b21ff4e..0b99bc9 100644
--- a/go/ssa/func.go
+++ b/go/ssa/func.go
@@ -257,6 +257,10 @@
}
}
+type setNumable interface {
+ setNum(int)
+}
+
// numberRegisters assigns numbers to all SSA registers
// (value-defining Instructions) in f, to aid debugging.
// (Non-Instruction Values are named at construction.)
@@ -267,9 +271,7 @@
for _, instr := range b.Instrs {
switch instr.(type) {
case Value:
- instr.(interface {
- setNum(int)
- }).setNum(v)
+ instr.(setNumable).setNum(v)
v++
}
}