String returns a string representation of prim in DOT format. Example output: digraph if_else { cond -> body_true cond -> body_false body_true -> exit body_false -> exit }
()
| 65 | // body_false -> exit |
| 66 | // } |
| 67 | func (prim IfElse) String() string { |
| 68 | cond, bodyTrue, bodyFalse, exit := label(prim.Cond), label(prim.BodyTrue), label(prim.BodyFalse), label(prim.Exit) |
| 69 | const format = ` |
| 70 | digraph if_else { |
| 71 | %v -> %v |
| 72 | %v -> %v |
| 73 | %v -> %v |
| 74 | %v -> %v |
| 75 | }` |
| 76 | return fmt.Sprintf(format[1:], cond, bodyTrue, cond, bodyFalse, bodyTrue, exit, bodyFalse, exit) |
| 77 | } |
| 78 | |
| 79 | // FindIfElse returns the first occurrence of a 2-way conditional statement in |
| 80 | // g, and a boolean indicating if such a primitive was found. |