Commit 221e8e3
fix(gxt-backend): unblock strict-mode runtime template compiler this/curried-helper
The GXT-mode `template()` runtime compiler in
@ember/template-compiler/runtime had two latent gaps that the
Strict-Mode - Runtime Template Compiler suite exercises but the
strict-mode `precompileTemplate` scope-merge work did not cover:
1. `Can use \`this\` from explicit scope` — when the user provides
`scope: () => ({ this: state })`, the binding was passed verbatim
as a `scopeValues.this` entry. The GXT compiler still emitted
literal `this.X` references against the rendering context, so the
user's `state` object was never reached. Pre-rewrite `{{this.X}}` /
`(this.X` / `<this.X` path heads to a non-keyword alias
(`__gxtExplicitThis`) and rebind that alias in `scopeValues`, so
GXT compiles the access as a normal binding-path lookup.
2. `Can use a curried dynamic helper` (implicit form) — direct `eval()`
in the test method's lexical scope was resolving `helper` to a
leaked module-level `let helper;` declared by the in-element
null-check helper in the same bundle. The implicit form's free-name
extractor then bound `helper` as a scope value, suppressing the
strict-mode `helper` keyword path. Filter `helper` and `modifier`
from `_extractScopeFromEval` so the keyword path always wins for
the implicit form. Users who genuinely want to shadow them can do
so via the explicit `scope` form.
Also defensively strip a stray `this` entry from the implicit form's
extracted scope, so a class-form template using `eval()` plus
`component: this` cannot accidentally have its rendering context
rewritten.
Validation:
- testem Basic Test: 15 fail -> 12 fail; both target tests now pass.
- Smoke 333/333 unchanged.
- No regression in any previously-passing test.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 420295b commit 221e8e3
1 file changed
Lines changed: 70 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
293 | 302 | | |
294 | 303 | | |
295 | 304 | | |
| |||
303 | 312 | | |
304 | 313 | | |
305 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
306 | 327 | | |
307 | 328 | | |
308 | 329 | | |
| |||
385 | 406 | | |
386 | 407 | | |
387 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
388 | 415 | | |
389 | 416 | | |
390 | 417 | | |
391 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
392 | 426 | | |
393 | 427 | | |
394 | 428 | | |
395 | 429 | | |
396 | 430 | | |
397 | 431 | | |
398 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
399 | 468 | | |
400 | 469 | | |
401 | | - | |
| 470 | + | |
402 | 471 | | |
403 | 472 | | |
404 | 473 | | |
| |||
0 commit comments