mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-05 08:13:06 +08:00
Three cases where a value's key order could differ from Node:
- A write of an optional key moved the key before its value was
evaluated. A value that adds another key to the same record, as in
`o.b = ((o.c = 1), 2)`, then put the keys in the wrong order. The write
now evaluates its value first, then tests and moves the key.
- A value seen as a JavaScript value bound the field hooks of its order
when it was boxed, and a later write that moved a key did not change
them. Shapes whose values can change order after they are built
(IrRecordShape.orderMoves) now read through the value's view, which
follows the current order.
- A literal that spreads a value with orders and then sets a key the
value may lack, as in `{ ...value, tag: "x" }`, put that key where the
source's order has it. Node puts it there only when the value has it,
and after the value's keys otherwise. The literal now picks its order
from the source's order and which of those keys the source has.
Corpus 7136 and 7138 cover each case.