MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / evalStack

Function evalStack

dql/parser.go:1560–1584  ·  view source on GitHub ↗
(opStack, valueStack *filterTreeStack)

Source from the content-addressed store, hash-verified

1558}
1559
1560func evalStack(opStack, valueStack *filterTreeStack) error {
1561 topOp, err := opStack.pop()
1562 if err != nil {
1563 return errors.Errorf("Invalid filter statement")
1564 }
1565 if topOp.Op == "not" {
1566 // Since "not" is a unary operator, just pop one value.
1567 topVal, err := valueStack.pop()
1568 if err != nil {
1569 return errors.Errorf("Invalid filter statement")
1570 }
1571 topOp.Child = []*FilterTree{topVal}
1572 } else {
1573 // "and" and "or" are binary operators, so pop two values.
1574 if valueStack.size() < 2 {
1575 return errors.Errorf("Invalid filter statement")
1576 }
1577 topVal1 := valueStack.popAssert()
1578 topVal2 := valueStack.popAssert()
1579 topOp.Child = []*FilterTree{topVal2, topVal1}
1580 }
1581 // Push the new value (tree) into the valueStack.
1582 valueStack.push(topOp)
1583 return nil
1584}
1585
1586func parseGeoArgs(it *lex.ItemIterator, g *Function) error {
1587 buf := new(bytes.Buffer)

Callers 1

parseFilterFunction · 0.85

Calls 5

popMethod · 0.45
ErrorfMethod · 0.45
sizeMethod · 0.45
popAssertMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected