Skip to content

Commit

Permalink
go/ssa: make a setNumable interface
Browse files Browse the repository at this point in the history
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 <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
  • Loading branch information
jirfag authored and randall77 committed Oct 1, 2019
1 parent 57610ed commit 4414aad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions go/ssa/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// (value-defining Instructions) in f, to aid debugging.
// (Non-Instruction Values are named at construction.)
Expand All @@ -267,9 +271,7 @@ func numberRegisters(f *Function) {
for _, instr := range b.Instrs {
switch instr.(type) {
case Value:
instr.(interface {
setNum(int)
}).setNum(v)
instr.(setNumable).setNum(v)
v++
}
}
Expand Down

0 comments on commit 4414aad

Please sign in to comment.