Skip to content

fix: ctx.X vs ctx_rN.X context references#2

Merged
Brooooooklyn merged 1 commit into
mainfrom
02-04-fix_ctx.x_vs_ctx_rn.x_context_references
Feb 4, 2026
Merged

fix: ctx.X vs ctx_rN.X context references#2
Brooooooklyn merged 1 commit into
mainfrom
02-04-fix_ctx.x_vs_ctx_rn.x_context_references

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Feb 4, 2026

resolve_expression in resolve_names.rs was missing a handler for IrExpression::Parenthesized. When convert_ast_to_ir converts Angular template expressions, parenthesized sub-expressions like !(item.private && !item.shareWithTeam) become
Not(Parenthesized(Binary(...))) in the IR. Since Parenthesized hit the _ => {} catch-all, all sub-expressions inside parentheses were never resolved — LexicalRead("item") references stayed unresolved and were later emitted as bare ctx.item instead of being resolved to the proper alias variable (e.g. item_r2 via nextContext()).

The fix adds IrExpression::Parenthesized handling to resolve_expression, recursing into the inner expression so that all nested variable references are properly resolved through the scope chain.

ClickUp comparison: 203 → 177 mismatches (26 files fixed, 97.0% match)


Note

Medium Risk
Touches name-resolution logic in the template compilation pipeline, which can affect emitted JS for many expression shapes; change is small but impacts correctness of variable/context capture in embedded views and listeners.

Overview
Fixes name resolution for IrExpression::Parenthesized by recursing into the inner expression, ensuring lexical reads inside parentheses are resolved to the correct scoped variables or context references.

Adds integration coverage for nested @if listeners (with and without outer aliases) to assert generated listeners use nextContext()/named ctx_rN variables rather than incorrectly emitting bare ctx or ctx.* for parent-scope references.

Written by Cursor Bugbot for commit eada628. This will update automatically on new commits. Configure here.

`resolve_expression` in `resolve_names.rs` was missing a handler for
`IrExpression::Parenthesized`. When `convert_ast_to_ir` converts Angular
template expressions, parenthesized sub-expressions like
`!(item.private && !item.shareWithTeam)` become
`Not(Parenthesized(Binary(...)))` in the IR. Since `Parenthesized` hit
the `_ => {}` catch-all, all sub-expressions inside parentheses were
never resolved — `LexicalRead("item")` references stayed unresolved and
were later emitted as bare `ctx.item` instead of being resolved to the
proper alias variable (e.g. `item_r2` via `nextContext()`).

The fix adds `IrExpression::Parenthesized` handling to
`resolve_expression`, recursing into the inner expression so that all
nested variable references are properly resolved through the scope
chain.

ClickUp comparison: 203 → 177 mismatches (26 files fixed, 97.0% match)
@Brooooooklyn Brooooooklyn merged commit 78b7a27 into main Feb 4, 2026
3 checks passed
@Brooooooklyn Brooooooklyn deleted the 02-04-fix_ctx.x_vs_ctx_rn.x_context_references branch February 4, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant