pass: cfg tests

This commit is contained in:
Michael McLoughlin
2018-12-02 13:50:55 -08:00
parent 43575d8b61
commit bc7d0fa410
3 changed files with 227 additions and 7 deletions

3
ast.go
View File

@@ -47,6 +47,9 @@ func (i Instruction) TargetLabel() *Label {
if !i.IsBranch {
return nil
}
if len(i.Operands) == 0 {
return nil
}
if ref, ok := i.Operands[0].(operand.LabelRef); ok {
lbl := Label(ref)
return &lbl