diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-03-31 15:29:22 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-04-01 22:25:55 +0300 |
| commit | 49fafee62c26e2a3fe3b3c792cc25505aee24295 (patch) | |
| tree | 4e96fd091b720da2395f8c5dd6e3e8a8a5455a3b /src/server/neo4j_cypher_parser.py | |
| parent | c4386e0a05e62c8c75db527469045fcaef66dd0c (diff) | |
sub_exp_set_by_type: fix logical recursion bug
Diffstat (limited to 'src/server/neo4j_cypher_parser.py')
| -rw-r--r-- | src/server/neo4j_cypher_parser.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/neo4j_cypher_parser.py b/src/server/neo4j_cypher_parser.py index 9fb87403..92c4762a 100644 --- a/src/server/neo4j_cypher_parser.py +++ b/src/server/neo4j_cypher_parser.py @@ -201,7 +201,7 @@ class pt_abs_composite_node(pt_abs_node): @param exp_type_or_set: type or set of types to check against using isinstance() @param recurse: whether to recursively search within sub expressions - @return: set of matched sub expressions, possibly empty + @return: set of matched sub expressions who match the given type set, possibly empty """ if isinstance(exp_type_or_set, list): @@ -214,11 +214,11 @@ class pt_abs_composite_node(pt_abs_node): if isinstance(n, exp_type): ctx += [n] ctx = [] - if not recurse: - f_cascade = lambda n, ctx, depth: True - self.tree_walk__pre(f_visit=f_visit, f_cascade=f_cascade, ctx=ctx) - else: - self.tree_walk__pre(f_visit=f_visit, ctx=ctx) + if False == recurse: + f_recurse = lambda _n, _ctx, _depth: False # do not recurse + if True == recurse: + f_recurse = lambda _n, _ctx, _depth: True # recurse + self.tree_walk__pre(f_visit=f_visit, f_recurse=f_recurse, ctx=ctx) return ctx def tree_walk__pre(self, f_pre=lambda n, ctx: None, |
