String returns a string representation of prim in DOT format. Example output: digraph if_return { cond -> body cond -> exit }
()
| 58 | // cond -> exit |
| 59 | // } |
| 60 | func (prim IfReturn) String() string { |
| 61 | cond, body, exit := label(prim.Cond), label(prim.Body), label(prim.Exit) |
| 62 | const format = ` |
| 63 | digraph if_return { |
| 64 | %v -> %v |
| 65 | %v -> %v |
| 66 | }` |
| 67 | return fmt.Sprintf(format[1:], cond, body, cond, exit) |
| 68 | } |
| 69 | |
| 70 | // FindIfReturn returns the first occurrence of a 1-way conditional with a body |
| 71 | // return statement in g, and a boolean indicating if such a primitive was |