Skip to content

Admit derived this after super - #3010

Merged
rogeralsing merged 1 commit into
mainfrom
codex/unified-bytecode-loop-50-derived-this-after-super
Jun 1, 2026
Merged

Admit derived this after super#3010
rogeralsing merged 1 commit into
mainfrom
codex/unified-bytecode-loop-50-derived-this-after-super

Conversation

@rogeralsing

Copy link
Copy Markdown
Contributor

Summary

  • allow derived constructor production-bytecode plan shapes to use this after a super(...) boundary
  • make sync VM LoadThis resolve the current environment this binding and throw the existing derived-constructor ReferenceError when it is still uninitialized
  • flip the super(); this.value = value runtime proof to require a production route hit and update constructor route docs

Verification

  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedName~UnifiedBytecodeProductionEligibilityTests.Evaluate_DerivedThisAssignmentAfterSuper_AcceptsOwnedPropertyWrite'
  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests.Evaluate_DerivedThisAssignmentAfterSuper_AcceptsOwnedPropertyWrite|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstructThenThisAssignment_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstruct_InitializesThis|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstructWithSpread_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.DerivedConstructorWithInstanceField_UsesProductionFastPathAndInitializesAfterSuper|FullyQualifiedNameClassSuperSemanticsTests'
  • rtk dotnet test tests/Asynkron.JsEngine.Tests -c Release --filter 'FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests|FullyQualifiedNameUnifiedBytecodeProductionInvocationTests|FullyQualifiedNameUnifiedBytecodeProductionSpreadCallTests|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests|FullyQualifiedNameExpressionProgramLoweringTests|FullyQualifiedNameExpressionProgramCoverageMapTests|FullyQualifiedName~AstFreeExecutionAssertionTests'
  • rtk dotnet build src/Asynkron.JsEngine/Asynkron.JsEngine.csproj -c Release
  • rtk rg 'EvaluateExpression(|ProfileEvaluateExpression(' src/Asynkron.JsEngine/Ast/TypedAstEvaluator.ExecutionPlanRunner*
  • rtk rg -n 'SuperConstructThenThisAssignment_Declines|without .*this|this body reads/writes|ClassConstructorActivation.*without|LoadThis.*return false' docs/unified-bytecode-expansion-contract.md tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionConstructCallTests.cs tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionEligibilityTests.cs src/Asynkron.JsEngine/Ast/TypedAstEvaluator.SyncFunctionInvoker.cs
  • rtk git diff --check

Roslynator/cosmetic gates intentionally skipped per maintainer direction to get bytecode route code in.

Copilot AI review requested due to automatic review settings June 1, 2026 20:51
@rogeralsing
rogeralsing merged commit a560060 into main Jun 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() this usage (e.g., this.value = ...) and updates related expectations.
  • Updates the unified-bytecode VM LoadThis opcode to resolve this from the current environment binding and to throw the existing derived-constructor ReferenceError when this is 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.

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.

2 participants