Commit 420295b
fix(gxt-backend): detect SubExpression refs in strict-mode scope threading
The strict-mode scope() callback merge in precompileTemplate was gated by
_templateMayNeedScopeThreading, which only fired when the template had a
PascalCase tag or a free-identifier mustache head. Templates whose only
mustache was `{{on "evt" (fn handler arg)}}` slipped through:
- The mustache head `on` is skipped (the visitor short-circuits {{on}})
- There is no PascalCase tag
- The SubExpression `(fn handler arg)` was never inspected
Result: `handler` and `fn` were never merged into scopeValues, the GXT
compiler emitted `$__fn(this.handler, ...)` (resolving against `this`,
not the strict-mode scope), and the click handler was a no-op.
Extend the gate to also scan for SubExpression heads `(ident ...)`. The
existing `_scopeNameAppearsAsReference` filter still prunes scope entries
the template never references, so loose / Input / Textarea templates stay
unaffected. Fixes the two `Strict Mode - built ins: Can use on and fn` and
`Strict Mode - renderComponent - built ins: Can use on and fn` tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 98b7365 commit 420295b
1 file changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11714 | 11714 | | |
11715 | 11715 | | |
11716 | 11716 | | |
| 11717 | + | |
| 11718 | + | |
| 11719 | + | |
| 11720 | + | |
| 11721 | + | |
| 11722 | + | |
| 11723 | + | |
| 11724 | + | |
| 11725 | + | |
| 11726 | + | |
| 11727 | + | |
| 11728 | + | |
| 11729 | + | |
| 11730 | + | |
| 11731 | + | |
11717 | 11732 | | |
11718 | 11733 | | |
11719 | 11734 | | |
| |||
0 commit comments