Add onTemplateError so one bad template does not abort the parse - #80
Closed
NullVoxPopuli-ai-agent wants to merge 2 commits into
Closed
NullVoxPopuli-ai-agent wants to merge 2 commits into
NullVoxPopuli-ai-agent wants to merge 2 commits into
Conversation
NullVoxPopuli-ai-agent
force-pushed
the
template-splice-fixes
branch
2 times, most recently
from
August 25, 2026 05:37
79cbe27 to
1c2443a
Compare
NullVoxPopuli-ai-agent
added a commit
to NullVoxPopuli-ai-agent/glint
that referenced
this pull request
Aug 25, 2026
Address review: no hand-rolled tree walk. Import bindings and template placement come from `ImportDeclaration` / `GlimmerTemplate` visitor callbacks, with `onTemplateError` (NullVoxPopuli/ember-estree#80) supplying the path of a template that fails to parse so it is placed like any other. The `this`-binding resolution is shared with the TS path (`thisBindingFromAncestors`); each path only maps its own AST to the ancestor kinds. Also drop the generic `templateLocation` fallback in `calculateTaggedTemplateSpans`: the only environment transform always records it, so assert instead. Needs ember-estree with typed-ember#80 (export default wrapper kept; onTemplateError). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FsXgxh6vNRWMCNcAQ3g6TN
NullVoxPopuli-ai-agent
force-pushed
the
template-splice-fixes
branch
from
August 25, 2026 05:41
1c2443a to
587735b
Compare
`export default <template>...</template>` spliced the GlimmerTemplate in place of the whole ExportDefaultDeclaration, so the tree and `print()` both lost the `export default`. The declaration is now what gets spliced. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FsXgxh6vNRWMCNcAQ3g6TN
A handlebars error in any `<template>` threw out of `toTree` mid-walk,
taking every other template and visitor callback with it. When the new
`onTemplateError(error, { range, contentRange, path })` option is
provided, that template is left as its placeholder and the walk
continues; without it, behaviour is unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FsXgxh6vNRWMCNcAQ3g6TN
NullVoxPopuli-ai-agent
force-pushed
the
template-splice-fixes
branch
from
August 25, 2026 17:54
587735b to
a73fc60
Compare
Contributor
Author
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.
Stacked on #82: this branch includes #82's commit, so the diff here shrinks to
onTemplateErroronly once #82 merges (GitHub won't accept a fork branch as base). The last commit on the branch is the one to review.A handlebars error in any
<template>throws out oftoTreemid-walk, so earlier visitor callbacks have fired and later ones never do. New option:When provided, the failing template is left as its placeholder and the walk continues;
pathis the visitor path itsGlimmerTemplatewould have had. Without the option, behaviour is unchanged (still throws). Documented in README /index.d.ts, with tests.Context: glint's standalone transform (typed-ember/glint#1226) parses each template itself and reports the error there; it only needs
toTreeto not abort.🤖 Generated with Claude Code
https://claude.ai/code/session_01FsXgxh6vNRWMCNcAQ3g6TN