Skip to content

Clean up scope bag, wire format, and debug render tree#21232

Open
NullVoxPopuli-ai-agent wants to merge 2 commits intoemberjs:mainfrom
NullVoxPopuli-ai-agent:scope-bag-object-cleanup
Open

Clean up scope bag, wire format, and debug render tree#21232
NullVoxPopuli-ai-agent wants to merge 2 commits intoemberjs:mainfrom
NullVoxPopuli-ai-agent:scope-bag-object-cleanup

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented Mar 23, 2026

Summary

Follow-up cleanup now that the scope bag is a Record<string, unknown> (#21224). Two commits:

1. Remove lexicalSymbols from wire format and dead debugSymbols codepath

Lexical symbol names are now always available via Object.keys(scope()), making two things redundant:

  • The optional lexicalSymbols slot in SerializedTemplateBlock
  • The emit.debugSymbols option — removed from the compiler, PrecompileOptionsWithLexicalScope type, test helpers (defComponent, createTemplate), and all test callsites

2. Remove template field from debug render tree

The name field already identifies components in the render tree (now reliably, thanks to the object-based scope bag). The template field (module name of the backing .hbs file) provided no useful information beyond what name gives, so it's removed from RenderNode, CapturedRenderNode, and all producers/consumers.

This deletes the moduleName resolution logic from the component opcode, templateName from route-template definition state, and the template parameter from getDebugCustomRenderTree.

Files changed

Area Files Change
Wire format @glimmer/interfaces (wire-format) Removed lexicalSymbols from SerializedTemplateBlock
Compiler @glimmer/compiler Removed block.push(usedLocals) debug symbols emission
Opcode compiler @glimmer/opcode-compiler (shared.ts) meta() derives lexical from scope object keys
Syntax @glimmer/syntax Removed emit.debugSymbols from types
Render tree types @glimmer/interfaces (debug-render-tree, component manager) Removed template from RenderNode, CapturedRenderNode, getDebugCustomRenderTree
Render tree impl @glimmer/runtime (debug-render-tree, component opcode) Removed captureTemplate, moduleName resolution
Ember managers route-template, outlet, mount Removed template/templateName fields
Test helpers defComponent, createTemplate, defineComponent Removed emit/moduleName/debugSymbols options
Tests Both debug-render-tree test files Removed ~190 template: assertion lines

Test plan

  • All 9138 tests pass (0 failures, 14 pre-existing skips)
  • Type checking passes (only pre-existing unrelated errors)

🤖 Generated with Claude Code

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent force-pushed the scope-bag-object-cleanup branch 2 times, most recently from 8e95b20 to 870420e Compare March 23, 2026 17:57
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent force-pushed the scope-bag-object-cleanup branch 2 times, most recently from 986f2d5 to d22590c Compare March 23, 2026 18:28
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent changed the title Make the scope bag an object instead of an array Remove lexicalSymbols from wire format and dead debugSymbols codepath Mar 23, 2026
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent changed the title Remove lexicalSymbols from wire format and dead debugSymbols codepath Clean up scope bag, wire format, and debug render tree Mar 23, 2026
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent force-pushed the scope-bag-object-cleanup branch 2 times, most recently from 9a621d4 to c79c0bf Compare March 23, 2026 19:22
NullVoxPopuli and others added 2 commits March 24, 2026 09:37
Now that the scope bag is an object (`Record<string, unknown>`), lexical
symbol names are always available via `Object.keys(scope())`. This makes
two things redundant:

- The optional `lexicalSymbols` slot in `SerializedTemplateBlock` (previously
  only populated when `emit.debugSymbols` was enabled)
- The `emit.debugSymbols` option itself — removed from the compiler,
  `PrecompileOptionsWithLexicalScope` type, test helpers, and test callsites

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The `name` field already identifies components in the render tree (now
reliably, thanks to the object-based scope bag). The `template` field
(module name of the backing template) adds no useful information beyond
what `name` provides, so remove it from `RenderNode`,
`CapturedRenderNode`, and all producers/consumers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ef4
Copy link
Copy Markdown
Contributor

ef4 commented Mar 24, 2026

Only concern is making sure that we aren't causing a regression here for inspector behavior for non-strict handlebars.

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

image https://github.com/ember-learn/ember-api-docs/pull/1007

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

hbs only works
image

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.

3 participants