diff --git a/pkg/expr/mongo.go b/pkg/expr/mongo.go index 8ff04088d14b4d5072644d2203a0d5a45da2779c..84471ccec2dcc526bd2d588bfd138d028c0202b6 100644 --- a/pkg/expr/mongo.go +++ b/pkg/expr/mongo.go @@ -643,6 +643,8 @@ func (c *compiler) PairNode(node *ast.PairNode) interface{} { //c.compile(node.Value) } +// notinPatcher проходит по лексемам ast-дерева +// и объединяет лексемы "not" и "in" в "not in" type notinPatcher struct{} func (t notinPatcher) Visit(node *ast.Node) { @@ -651,14 +653,14 @@ func (t notinPatcher) Visit(node *ast.Node) { return } - inNode, ok := nodeNot.Node.(*ast.BinaryNode) - if !ok || inNode.Operator != "in" { + nodeIn, ok := nodeNot.Node.(*ast.BinaryNode) + if !ok || nodeIn.Operator != "in" { return } nodeNot.Operator = "" ast.Patch(node, nodeNot) - inNode.Operator = "not in" - ast.Patch(&nodeNot.Node, inNode) + nodeIn.Operator = "not in" + ast.Patch(&nodeNot.Node, nodeIn) } \ No newline at end of file