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

Method FromExpr

expr/node.go:1757–1777  ·  view source on GitHub ↗
(e *Expr)

Source from the content-addressed store, hash-verified

1755 return fe
1756}
1757func (m *UnaryNode) FromExpr(e *Expr) error {
1758 if e.Op == "" {
1759 return fmt.Errorf("unrecognized UnaryNode no op")
1760 }
1761 m.Operator = lex.TokenFromOp(e.Op)
1762 if m.Operator.T == lex.TokenNil {
1763 return fmt.Errorf("Unrecognized op %v", e.Op)
1764 }
1765 if len(e.Args) == 0 {
1766 return fmt.Errorf("Invalid UnaryNode, expected 1 args %+v", e)
1767 }
1768 if len(e.Args) > 1 {
1769 return fmt.Errorf("Invalid UnaryNode, expected 1 args %+v", e)
1770 }
1771 arg, err := NodeFromExpr(e.Args[0])
1772 if err != nil {
1773 return err
1774 }
1775 m.Arg = arg
1776 return nil
1777}
1778func (m *UnaryNode) Equal(n Node) bool {
1779 if m == nil && n == nil {
1780 return true

Callers

nothing calls this directly

Calls 3

TokenFromOpFunction · 0.92
NodeFromExprFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected