(node *ast.Node, newNature Nature)
| 1191 | } |
| 1192 | |
| 1193 | func traverseAndReplaceIntegerNodesWithIntegerNodes(node *ast.Node, newNature Nature) { |
| 1194 | switch (*node).(type) { |
| 1195 | case *ast.IntegerNode: |
| 1196 | (*node).SetType(newNature.Type) |
| 1197 | case *ast.UnaryNode: |
| 1198 | (*node).SetType(newNature.Type) |
| 1199 | unaryNode := (*node).(*ast.UnaryNode) |
| 1200 | traverseAndReplaceIntegerNodesWithIntegerNodes(&unaryNode.Node, newNature) |
| 1201 | case *ast.BinaryNode: |
| 1202 | // TODO: Binary node return type is dependent on the type of the operands. We can't just change the type of the node. |
| 1203 | binaryNode := (*node).(*ast.BinaryNode) |
| 1204 | switch binaryNode.Operator { |
| 1205 | case "+", "-", "*": |
| 1206 | traverseAndReplaceIntegerNodesWithIntegerNodes(&binaryNode.Left, newNature) |
| 1207 | traverseAndReplaceIntegerNodesWithIntegerNodes(&binaryNode.Right, newNature) |
| 1208 | } |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | func (v *Checker) predicateNode(node *ast.PredicateNode) Nature { |
| 1213 | nt := v.visit(node.Node) |
no test coverage detected
searching dependent graphs…