Recompute state flags from the current scope stack.
| 32 | |
| 33 | // Recompute state flags from the current scope stack. |
| 34 | static void recompute_state(WalkState *state, const char *module_qn) { |
| 35 | state->enclosing_func_qn = module_qn; |
| 36 | state->enclosing_class_qn = NULL; |
| 37 | state->inside_call = false; |
| 38 | state->inside_import = false; |
| 39 | state->loop_depth = 0; |
| 40 | state->branch_depth = 0; |
| 41 | |
| 42 | for (int i = 0; i < state->scope_top; i++) { |
| 43 | switch (state->scopes[i].kind) { |
| 44 | case SCOPE_FUNC: |
| 45 | state->enclosing_func_qn = state->scopes[i].qn; |
| 46 | break; |
| 47 | case SCOPE_CLASS: |
| 48 | state->enclosing_class_qn = state->scopes[i].qn; |
| 49 | break; |
| 50 | case SCOPE_CALL: |
| 51 | state->inside_call = true; |
| 52 | break; |
| 53 | case SCOPE_IMPORT: |
| 54 | state->inside_import = true; |
| 55 | break; |
| 56 | case SCOPE_LOOP: |
| 57 | state->loop_depth++; |
| 58 | break; |
| 59 | case SCOPE_BRANCH: |
| 60 | state->branch_depth++; |
| 61 | break; |
| 62 | default: |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // Try to resolve Wolfram function QN from set_delayed_top/set_top/set_delayed/set LHS. |
| 69 | static const char *compute_wolfram_func_qn(CBMExtractCtx *ctx, TSNode node) { |
no outgoing calls
no test coverage detected