Skip to content
Snippets Groups Projects
Commit 6dd43dc3 authored by Danis Kirasirov's avatar Danis Kirasirov
Browse files

add comment

parent 9c1dec9f
No related branches found
No related tags found
No related merge requests found
...@@ -643,6 +643,8 @@ func (c *compiler) PairNode(node *ast.PairNode) interface{} { ...@@ -643,6 +643,8 @@ func (c *compiler) PairNode(node *ast.PairNode) interface{} {
//c.compile(node.Value) //c.compile(node.Value)
} }
// notinPatcher проходит по лексемам ast-дерева
// и объединяет лексемы "not" и "in" в "not in"
type notinPatcher struct{} type notinPatcher struct{}
func (t notinPatcher) Visit(node *ast.Node) { func (t notinPatcher) Visit(node *ast.Node) {
...@@ -651,14 +653,14 @@ func (t notinPatcher) Visit(node *ast.Node) { ...@@ -651,14 +653,14 @@ func (t notinPatcher) Visit(node *ast.Node) {
return return
} }
inNode, ok := nodeNot.Node.(*ast.BinaryNode) nodeIn, ok := nodeNot.Node.(*ast.BinaryNode)
if !ok || inNode.Operator != "in" { if !ok || nodeIn.Operator != "in" {
return return
} }
nodeNot.Operator = "" nodeNot.Operator = ""
ast.Patch(node, nodeNot) ast.Patch(node, nodeNot)
inNode.Operator = "not in" nodeIn.Operator = "not in"
ast.Patch(&nodeNot.Node, inNode) ast.Patch(&nodeNot.Node, nodeIn)
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment