fix(engine): correct WithBaseObject and HasBinding semantics for with calls - #5507
Open
xcb3d wants to merge 3 commits into
Open
fix(engine): correct WithBaseObject and HasBinding semantics for with calls#5507xcb3d wants to merge 3 commits into
xcb3d wants to merge 3 commits into
Conversation
… calls - In function calls within with blocks, evaluate GetNameAndLocator first to resolve the binding and callee value, pushing the locator onto binding_stack. - Derive the this value (WithBaseObject) via ThisForObjectEnvironmentName directly from the resolved binding locator without re-scanning the environment chain, ensuring HasBinding runs only once per spec. - Remove unused IndexOperand from ThisForObjectEnvironmentName to save bytecode space. - Implement step 2 of GetBindingValue (N, S) for ObjectEnvironmentRecord to verify property presence before Get, returning undefined in sloppy mode or throwing ReferenceError in strict mode when deleted via @@unscopables. - Add engine-level unit tests for proxy traps and @@unscopables deletion under with.
Test262 conformance changes
Fixed tests (5):Tested main commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5507 +/- ##
===========================================
+ Coverage 47.24% 63.06% +15.82%
===========================================
Files 476 536 +60
Lines 46892 60281 +13389
===========================================
+ Hits 22154 38019 +15865
+ Misses 24738 22262 -2476 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nekevss
requested changes
Sep 5, 2026
nekevss
left a comment
Member
There was a problem hiding this comment.
Please add an insta-bytecode test for this change as well.
Pins the bytecode for a with-statement call: GetNameAndLocator resolves the binding/locator once, then the dst-only ThisForObjectEnvironmentName derives the call's this (WithBaseObject), per PR boa-dev#5507.
Prettier reflowed the `with (...)` object literal onto multiple lines. The reformat only shifted the source position of the call, so the insta-bytecode snapshot was re-accepted (Source Map offset only); the compiled opcodes are unchanged and it still asserts GetNameAndLocator followed by a dst-only ThisForObjectEnvironmentName.
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.
This Pull Request fixes the evaluation order and semantics of
WithBaseObjectandHasBindingfor function calls withinwithstatements, as well as property verification inGetBindingValuefor object environment records.It changes the following:
withblocks, evaluateGetNameAndLocatorfirst to resolve the binding and callee value, pushing the locator ontobinding_stack.thisvalue (WithBaseObject) viaThisForObjectEnvironmentNamedirectly from the resolved binding locator without re-scanning the environment chain, ensuringHasBindingruns only once per spec.IndexOperandfromThisForObjectEnvironmentNameto save bytecode space.GetBindingValue ( N, S )forObjectEnvironmentRecordto verify property presence beforeGet, returningundefinedin sloppy mode or throwingReferenceErrorin strict mode when deleted via@@unscopables.@@unscopablesdeletion underwith.