returns true if AST clause type is compressible
| 328 | |
| 329 | // returns true if AST clause type is compressible |
| 330 | static inline bool is_compressible |
| 331 | ( |
| 332 | const cypher_astnode_t *clause, // clause to check |
| 333 | cypher_astnode_type_t type // type of clause |
| 334 | ) { |
| 335 | // compressible clauses: |
| 336 | // 1. Non-OPTIONAL MATCH |
| 337 | // 2. CREATE |
| 338 | // 3. SET |
| 339 | // 4. DELETE |
| 340 | // 5. REMOVE |
| 341 | return ((type == CYPHER_AST_MATCH && |
| 342 | !cypher_ast_match_is_optional(clause)) || |
| 343 | type == CYPHER_AST_CREATE || |
| 344 | type == CYPHER_AST_SET || |
| 345 | type == CYPHER_AST_DELETE || |
| 346 | type == CYPHER_AST_REMOVE); |
| 347 | } |
| 348 | |
| 349 | // rewrite result by compressing consecutive clauses of the same type |
| 350 | // to a single clause, returning true if the rewrite has been performed |