Admit binary template substitutions in call args - #3011
Merged
rogeralsing merged 1 commit intoJun 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR widens unified-bytecode production routing to admit a specific previously-declined call-argument shape: untagged template literals whose substitution is a simple binary expression (e.g. `result: ${a + b}`). This fits into the existing “simple template literal span” machinery used by the production eligibility checker and unified-bytecode compiler.
Changes:
- Add coverage proving the unified-bytecode production fast-path is hit for a template literal containing a binary substitution.
- Update production eligibility scanning to recognize the op-sequence for a simple binary substitution inside a template literal span.
- Update the unified-bytecode compiler to emit unified bytecode for that binary-substitution template span and adjust the decline-contract doc row accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionInvocationTests.cs | Adds a runtime/route-hit test proving the fast-path is used for ${a + b} inside an untagged template literal call argument. |
| tests/Asynkron.JsEngine.Tests/UnifiedBytecodeProductionEligibilityTests.cs | Updates eligibility expectations for the ${a + b} template substitution shape (now accepted) and adds instruction-level assertions. |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeProductionEligibility.cs | Extends “simple template literal span” measurement to include a recognized 5-op binary-substitution sequence. |
| src/Asynkron.JsEngine/Execution/UnifiedBytecode/UnifiedBytecodeCompiler.cs | Extends template literal span compilation to emit unified bytecode for binary substitutions; introduces a helper for pre-checking operand-load eligibility. |
| docs/unified-bytecode-expansion-contract.md | Updates the CallDependency row text and proof command to reflect the newly admitted template-literal substitution shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+8837
to
+8850
| TryAppendSimpleOperandLoad( | ||
| op, | ||
| expressionProgram, | ||
| activationSlots, | ||
| unified, | ||
| literalConstants, | ||
| out _); | ||
| TryAppendSimpleOperandLoad( | ||
| rightOperand, | ||
| expressionProgram, | ||
| activationSlots, | ||
| unified, | ||
| literalConstants, | ||
| out _); |
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