Admit derived this after super - #3010
Merged
rogeralsing merged 1 commit intoJun 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the unified-bytecode “production fast path” for derived class constructors so that this can be safely read/written after the super() boundary, matching ES derived-constructor semantics while keeping execution on the production VM route.
Changes:
- Expands derived-constructor production eligibility to allow post-
super()thisusage (e.g.,this.value = ...) and updates related expectations. - Updates the unified-bytecode VM
LoadThisopcode to resolvethisfrom the current environment binding and to throw the existing derived-constructorReferenceErrorwhenthisis still uninitialized. - Adjusts tests and contract docs to reflect that the derived-constructor route now uses the production fast path for
super(); this...patterns.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionEligibilityTests.cs | Adds eligibility coverage for derived constructors writing to this after super(). |
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionConstructCallTests.cs | Updates a constructor test to assert the production fast path is used after super(); this.... |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeVirtualMachine.cs | Changes LoadThis to resolve this via environment binding and throw on uninitialized derived-constructor this. |
| src/Asynkron.JsEngine/Ast/TypedAstEvaluator.SyncFunctionInvoker.cs | Updates derived-constructor production plan-shape scan to permit LoadThis. |
| docs/unified-bytecode-expansion-contract.md | Updates documentation to reflect the admitted derived-constructor this usage after super(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Verification
UnifiedBytecodeProductionEligibilityTests.Evaluate_DerivedThisAssignmentAfterSuper_AcceptsOwnedPropertyWrite|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstructThenThisAssignment_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstruct_InitializesThis|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstructWithSpread_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.DerivedConstructorWithInstanceField_UsesProductionFastPathAndInitializesAfterSuper|FullyQualifiedNameClassSuperSemanticsTests'UnifiedBytecodeProductionEligibilityTests|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests|FullyQualifiedNameUnifiedBytecodeProductionSpreadCallTests|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests|FullyQualifiedNameExpressionProgramLoweringTests|FullyQualifiedNameExpressionProgramCoverageMapTests|FullyQualifiedName~AstFreeExecutionAssertionTests'Roslynator/cosmetic gates intentionally skipped per maintainer direction to get bytecode route code in.