镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Commit 6b60d84

Browse files
committed
fix(vm): lower evaluated captured patterns
Compile defaults, computed keys, nested patterns, and object rest directly in the active per-iteration environment instead of rejecting the enclosing function. Preserve RequireObjectCoercible ordering, single ToPropertyKey coercion, IteratorClose, anonymous-function naming, TDZ initialization, and generator/async suspension. For example, for (const {[key()]: value = fallback, ...rest} of inputs) can now remain in required bytecode while closures capture a fresh value and rest object for each iteration. Validation: 1,494/1,494 units, focused TSan 2/2, ReleaseFast test262 53,175/53,175 configured cases with zero skipped or failures, and threadfuzz 400/400. Flips 0 test262 cases.
1 parent 7c8b5ea commit 6b60d84

5 files changed

Lines changed: 261 additions & 104 deletions

File tree

‎src/bytecode.zig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ pub const Op = enum(u8) {
332332
to_numeric, // ToNumeric(pop) -> Number or BigInt (the postfix `x++` old value)
333333
inc, // ToNumeric(pop) then +1 of the matching numeric type
334334
dec, // ToNumeric(pop) then -1 of the matching numeric type
335+
require_object_coercible, // pop; throw for null/undefined before an object binding pattern evaluates keys
335336
to_property_key, // ToPropertyKey(pop) -> the property-key string (runs toString once)
336337
name_anon, // NamedEvaluation: name the top-of-stack anonymous function (operand a: name)
337338

@@ -375,6 +376,7 @@ pub const Op = enum(u8) {
375376
init_prop, // operand a: name index; pop value, define own data prop on object at top, leave object
376377
init_proto, // pop value; if object/null set it as the [[Prototype]] of object at top (the `__proto__: v` colon form), leave object
377378
init_prop_computed, // pop key, pop value, set on object at top, leave object
379+
object_rest, // operand a: excluded-key count; pop keys then source, push CopyDataProperties result
378380
init_spread, // pop source, CopyDataProperties into object at top, leave object
379381
init_getter, // pop fn, pop key; install getter on object at top, leave object
380382
init_setter, // pop fn, pop key; install setter on object at top, leave object

0 commit comments

Comments
 (0)