Add builtin keyword helpers (fn, hash, array, and, or, not, eq, neq, lt, lte, gt, gte)#21229
Closed
NullVoxPopuli-ai-agent wants to merge 3 commits intoemberjs:nvp/on-as-keyword-tremplate-the-transform-wayfrom
Conversation
sketching some updates @ef4 -- it doesn't work Use globalThis lint:fix
…lt, lte, gt, gte Building on the foundation from emberjs#21068 (on as keyword), this adds all remaining helpers as strict-mode keywords per their respective RFCs: - fn (RFC 998), hash (RFC 999), array (RFC 1000) - and, or, not (RFC 562) - lt, lte, gt, gte (RFC 561) - eq, neq (RFC 560) Each helper is implemented as a Glimmer internal helper in @glimmer/runtime, exported from @ember/helper, and registered in the auto-import-builtins AST plugin for strict-mode templates only. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- fn: Use fn in SubExpression position with on modifier (fn creates partial application, not a direct invocation) - array: Use array in SubExpression position with fn+on instead of each (avoids strict mode resolution edge case with each keyword) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
202a724 to
a5c1907
Compare
360c67b to
5403b05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Building on the foundation from #21068 (
onas keyword), this PR adds all remaining helpers as strict-mode keywords per their respective RFCs:fn(RFC #998),hash(RFC #999),array(RFC #1000) — already existed as helpers, now registered as keywordsand,or,not(RFC #562) — new helper implementations + keyword registrationlt,lte,gt,gte(RFC #561) — new helper implementations + keyword registrationeq,neq(RFC #560) — new helper implementations + keyword registrationWhat this means
In strict-mode templates (
.gjs/.gts/<template>), these helpers are now available without importing them:All keywords can still be shadowed by local scope definitions, maintaining backwards compatibility.
Implementation
and,or,not,eq,neq,lt,lte,gt,gte) implemented as Glimmer internal helpers in@glimmer/runtime@ember/helperauto-import-builtinsAST plugin extended to handleMustacheStatementandSubExpressionnodes (in addition toElementModifierStatementforon)Not included
element(RFC #389) — this involves contextual components and needs separate implementationTest plan
🤖 Generated with Claude Code