MCPcopy Create free account
hub / github.com/araddon/qlbridge / NewUnary

Function NewUnary

expr/node.go:1682–1700  ·  view source on GitHub ↗

Unary nodes NOT ! EXISTS IS NOT NULL

(operator lex.Token, arg Node)

Source from the content-addressed store, hash-verified

1680// <identity> IS NOT NULL
1681//
1682func 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}
1701func (m *UnaryNode) NodeType() string { return "Unary" }
1702func (m *UnaryNode) String() string {
1703 w := NewDefaultWriter()

Callers 4

CollapseMethod · 0.85
resolveIncludeFunction · 0.85
CMethod · 0.85
FMethod · 0.85

Calls 2

ReverseNegationMethod · 0.65
CollapseMethod · 0.65

Tested by

no test coverage detected