rewrite result by compressing consecutive clauses of the same type to a single clause, returning true if the rewrite has been performed
| 349 | // rewrite result by compressing consecutive clauses of the same type |
| 350 | // to a single clause, returning true if the rewrite has been performed |
| 351 | bool AST_RewriteSameClauses |
| 352 | ( |
| 353 | const cypher_astnode_t *root // root of AST |
| 354 | ) { |
| 355 | bool rewritten = false; |
| 356 | |
| 357 | if(cypher_astnode_type(root) != CYPHER_AST_STATEMENT) { |
| 358 | return rewritten; |
| 359 | } |
| 360 | |
| 361 | // retrieve the root's body |
| 362 | const cypher_astnode_t *body = cypher_ast_statement_get_body(root); |
| 363 | if(cypher_astnode_type(body) != CYPHER_AST_QUERY) { |
| 364 | return rewritten; |
| 365 | } |
| 366 | |
| 367 | // traverse clauses |
| 368 | // compress consecutive clauses |
| 369 | return _compress_clauses(body); |
| 370 | } |
no test coverage detected