mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
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>
This commit is contained in:
parent
57610eddc9
commit
4414aad16c
@ -257,6 +257,10 @@ func (f *Function) createSyntacticParams(recv *ast.FieldList, functype *ast.Func
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type setNumable interface {
|
||||||
|
setNum(int)
|
||||||
|
}
|
||||||
|
|
||||||
// numberRegisters assigns numbers to all SSA registers
|
// numberRegisters assigns numbers to all SSA registers
|
||||||
// (value-defining Instructions) in f, to aid debugging.
|
// (value-defining Instructions) in f, to aid debugging.
|
||||||
// (Non-Instruction Values are named at construction.)
|
// (Non-Instruction Values are named at construction.)
|
||||||
@ -267,9 +271,7 @@ func numberRegisters(f *Function) {
|
|||||||
for _, instr := range b.Instrs {
|
for _, instr := range b.Instrs {
|
||||||
switch instr.(type) {
|
switch instr.(type) {
|
||||||
case Value:
|
case Value:
|
||||||
instr.(interface {
|
instr.(setNumable).setNum(v)
|
||||||
setNum(int)
|
|
||||||
}).setNum(v)
|
|
||||||
v++
|
v++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user