* Negation I wanted to do negation on Binaries, but ended up not doing for now ie, rewrite NOT (X == "y") => X != "y" The general problem we ran into is that we lose some fidelity in collapsing AST that is necessary for other evaluation run-times. logically `NOT (X > y)` is NOT THE SAME AS
()
| 1315 | } |
| 1316 | */ |
| 1317 | func (m *BinaryNode) Validate() error { |
| 1318 | if len(m.Args) != 2 { |
| 1319 | return fmt.Errorf("not enough args in binary expected 2 got %d", len(m.Args)) |
| 1320 | } |
| 1321 | for _, n := range m.Args { |
| 1322 | if err := n.Validate(); err != nil { |
| 1323 | return err |
| 1324 | } |
| 1325 | } |
| 1326 | return nil |
| 1327 | } |
| 1328 | func (m *BinaryNode) ChildrenArgs() []Node { |
| 1329 | return m.Args |
| 1330 | } |