{{ message }}
Fix live debugger this capture before super#406
Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits intoJun 12, 2026
Conversation
Live Debugger instrumentation always passed `this` to probe hooks. For arrows that run while evaluating `super()` arguments in derived constructors, that turns otherwise valid code into a ReferenceError because constructor `this` is not initialized yet. Track arrows whose lexical `this` comes from a derived constructor, create a constructor-scoped `$dd_t` alias, and assign it from wrapped `super()` calls. Those arrows pass `$dd_t` to entry/return/throw hooks, while other arrows and non-arrow functions keep their normal `this` behavior. Add regression and exact-output coverage for the derived constructor case.
Contributor
Author
Member
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
tylfin
reviewed
Jun 12, 2026
tylfin
approved these changes
Jun 12, 2026
Contributor
Author
|
/merge |
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.


What and why?
Fix Live Debugger instrumentation for arrows that execute before
super()completes in derived class constructors. The transform previously injected probe calls that accessedthis, which can crash valid derived-constructor code whilesuper()arguments are still being evaluated.Before instrumentation, this pattern is valid:
Before this fix, probing the arrow could inject code that accessed constructor
thisbeforesuper()returned:After this fix, affected arrows use a constructor-scoped
$dd_talias that is assigned fromsuper():How?
The transform now detects arrows whose lexical
thiscomes from a derived constructor, emits one constructor-scoped$dd_talias, and assigns it from wrappedsuper()calls. Affected arrows pass$dd_tto$dd_entry,$dd_return, and$dd_throw; arrows outside derived constructors and non-arrow function expressions continue to use their normalthis.Added regression coverage for the reported
super(items.map((x) => x * 2))pattern, a guard for non-arrow function expressions, and an exact-output smoke test for the generated$dd_tshape.Verified with:
yarn test:unit packages/plugins/live-debugger/src/transform/index.test.tsyarn lint packages/plugins/live-debugger/src/transform/index.ts packages/plugins/live-debugger/src/transform/index.test.tsyarn cli typecheck-workspaces --files packages/plugins/live-debugger/src/transform/index.ts --files packages/plugins/live-debugger/src/transform/index.test.ts