MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _AST_MapExpression

Function _AST_MapExpression

src/ast/ast_build_reference_map.c:31–53  ·  view source on GitHub ↗

Map identifiers within an expression.

Source from the content-addressed store, hash-verified

29
30// Map identifiers within an expression.
31static void _AST_MapExpression(AST *ast, const cypher_astnode_t *exp) {
32 cypher_astnode_type_t type = cypher_astnode_type(exp);
33
34 // In case of identifier.
35 if(type == CYPHER_AST_IDENTIFIER) {
36 const char *identifier_name = cypher_ast_identifier_get_name(exp);
37 _AST_UpdateRefMap(ast, identifier_name);
38 } else if(type == CYPHER_AST_PATTERN_PATH) {
39 // In case of pattern filter or path projection.
40 _AST_MapReferencedEntitiesInPath(ast, exp, true);
41 } else if(type == CYPHER_AST_SHORTEST_PATH) {
42 // Reference all entity names in a shortest path.
43 _AST_MapReferencedEntitiesInPath(ast, exp, true);
44 } else {
45 // Recurse over children.
46 uint child_count = cypher_astnode_nchildren(exp);
47 for(uint i = 0; i < child_count; i++) {
48 const cypher_astnode_t *child = cypher_astnode_get_child(exp, i);
49 // Recursively continue mapping.
50 _AST_MapExpression(ast, child);
51 }
52 }
53}
54
55// Maps the RHS of "AS" projected entities.
56static inline void _AST_MapProjectionAlias(AST *ast, const cypher_astnode_t *projection) {

Calls 2

_AST_UpdateRefMapFunction · 0.85

Tested by

no test coverage detected