Admit default derived constructors to production bytecode#3037
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the production unified-bytecode “construct” fast path to include synthetic default-derived constructors (i.e., class Derived extends Base {}), ensuring their implicit super(...args) behavior is handled efficiently and with the intended argument-forwarding semantics.
Changes:
- Admits default-derived constructors into the production unified-bytecode eligibility/fast-path flow (including the super-construct invocation boundary).
- Binds the synthetic rest parameter as a
JsArrayin production slots/environments and forwardssuper(...args)by extracting items directly (avoiding generic spread materialization). - Updates tests and the unified-bytecode expansion contract docs to reflect the new admission rules (and removes the stale pre-gate entry).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionEligibilityTests.cs | Adds eligibility coverage to ensure default-derived constructors can pass production gating and include the super-construct boundary + spread masks. |
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionConstructCallTests.cs | Updates/extends construct-call tests to assert default-derived constructors take the production fast path and validate forwarding behavior expectations. |
| tests/Asynkron.JsEngine.Tests/ExpressionProgramCoverageMapTests.cs | Removes the “pre-gate:IsDefaultDerivedConstructor” heading expectation to match the updated contract/gating model. |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeVirtualMachine.cs | Adds a specialized forwarding path for default-derived super(...args) to avoid generic spread materialization. |
| src/Asynkron.JsEngine/Ast/TypedAstEvaluator.SyncFunctionInvoker.cs | Adjusts production-slot/environment parameter binding to support a synthetic rest argument array for default-derived constructors and admits the new parameter shape. |
| docs/unified-bytecode-expansion-contract.md | Updates contract text to document default-derived constructor admission and removes the stale pre-gate row. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+665
to
+667
| Array.prototype[Symbol.iterator] = function() { | ||
| throw new Error('iterator should not run'); | ||
| }; |
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
UnifiedBytecodeProductionConstructCallTests.DefaultDerivedConstructor_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.DefaultDerivedConstructor_ForwardsArgumentsWithoutIteratorProtocol|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstructWithSpread_UsesProductionFastPath|FullyQualifiedNameUnifiedBytecodeProductionConstructCallTests.SuperConstruct_InitializesThis|FullyQualifiedNameUnifiedBytecodeProductionEligibilityTests.Evaluate_DefaultDerivedConstructor_AcceptsSuperConstructInvocationBoundary|FullyQualifiedNameExpressionProgramCoverageMapTests.UnifiedBytecodeExpansionContract_ListsRequiredHeadingsAndCurrentEnums'