Unary nodes NOT ! EXISTS IS NOT NULL
(operator lex.Token, arg Node)
| 1680 | // <identity> IS NOT NULL |
| 1681 | // |
| 1682 | func NewUnary(operator lex.Token, arg Node) Node { |
| 1683 | nn, ok := arg.(NegateableNode) |
| 1684 | switch operator.T { |
| 1685 | case lex.TokenNegate: |
| 1686 | if ok { |
| 1687 | nn.ReverseNegation() |
| 1688 | return nn.Collapse() |
| 1689 | } |
| 1690 | } |
| 1691 | |
| 1692 | // In the event we are adding a binary here, we might have |
| 1693 | // rewritten a little so lets make sure its interpreted/nested coorectly |
| 1694 | bn, isBinary := arg.(*BinaryNode) |
| 1695 | if isBinary { |
| 1696 | bn.Paren = true |
| 1697 | } |
| 1698 | |
| 1699 | return &UnaryNode{Arg: arg, Operator: operator} |
| 1700 | } |
| 1701 | func (m *UnaryNode) NodeType() string { return "Unary" } |
| 1702 | func (m *UnaryNode) String() string { |
| 1703 | w := NewDefaultWriter() |
no test coverage detected