Rightmost lit_string under `node` in DFS order. Both dbt builtins put the * referenced relation last: ref('model'), ref('package', 'model') and * source('group', 'table') all name the relation in their final string * argument. The callee itself is an identifier, never a lit_string, so it * cannot be mistaken for one. */
| 82 | * argument. The callee itself is an identifier, never a lit_string, so it |
| 83 | * cannot be mistaken for one. */ |
| 84 | static TSNode dbt_last_lit_string(TSNode node, TSNode best, bool *found) { |
| 85 | if (strcmp(ts_node_type(node), "lit_string") == 0) { |
| 86 | best = node; |
| 87 | *found = true; |
| 88 | } |
| 89 | uint32_t cc = ts_node_child_count(node); |
| 90 | for (uint32_t i = 0; i < cc; i++) { |
| 91 | best = dbt_last_lit_string(ts_node_child(node, i), best, found); |
| 92 | } |
| 93 | return best; |
| 94 | } |
| 95 | |
| 96 | /* Collect ref()/source() targets from a jinja2 parse tree into `out`, which is |
| 97 | * the file's usage array. Usages are scoped to enclosing_qn (the Model). */ |