Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 970dcc8db7e57aeade0101a0d9b0996e2ec4190c
https://github.com/WebKit/WebKit/commit/970dcc8db7e57aeade0101a0d9b0996e2ec4190c
Author: Sosuke Suzuki <[email protected]>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M JSTests/stress/catch-rest-parameter.js
M JSTests/stress/iterator-error-messages-consistent.js
A JSTests/stress/iterator-open-expression-info.js
M LayoutTests/js/arguments-iterator-expected.txt
M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Log Message:
-----------
[JSC] Emit expression info before `[Symbol.iterator]` get and spread
https://bugs.webkit.org/show_bug.cgi?id=317733
Reviewed by Yusuke Suzuki.
When the subject of for-of / for-await-of / array destructuring / yield* /
array spread is a constant or other node that does not itself emit expression
info (e.g. a null or undefined literal), the get_by_id for [Symbol.iterator]
(or the OpSpread) inherited the previous statement's expression range. The
resulting TypeError was attributed to the wrong line and the "evaluating '...'"
text quoted the previous statement.
print("here");
for (const b of null) {}
// TypeError: null is not an object (evaluating 'print("here")')
// at test.js:1:6
Emit expression info from the enclosing ThrowableExpressionData before each of
these ops so the throw is attributed to the iterating construct itself,
matching what emitIteratorOpen / emitIteratorNext already do.
// TypeError: null is not an object (evaluating 'b of null')
// at test.js:2:14
Test: JSTests/stress/iterator-open-expression-info.js
* JSTests/stress/catch-rest-parameter.js:
(async let):
(shouldThrow.async f):
(shouldThrow.f):
* JSTests/stress/iterator-error-messages-consistent.js:
* JSTests/stress/iterator-open-expression-info.js: Added.
(shouldBe):
(await):
* LayoutTests/js/arguments-iterator-expected.txt:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitNewArrayWithSpread):
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitConstructImpl):
(JSC::BytecodeGenerator::emitEnumeration):
(JSC::BytecodeGenerator::emitGetGenericIterator):
(JSC::BytecodeGenerator::emitGetAsyncIterator):
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::ArrayPatternNode::bindValue const):
Canonical link: https://commits.webkit.org/315867@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications