Hi!
I noticed that copying an object with the spread operator may produce
another shape:
```js
const x = { a: 1, b: 2 };
const y = {}; y.a = 1; y.b = 2;
const xCopied = { ...x };
const yCopied = { ...y };
console.log(%HaveSameMap(x, xCopied)); // FALSE
console.log(%HaveSameMap(y, xCopied)); // true
console.log(%HaveSameMap(y, yCopied)); // true
```
According to the previous example, the spread operator is simply a syntaxic
sugar for:
```
const xCopied = {}; z.a = xCopied.a; xCopied.b = x.b;
```
I am wondering if there is any plan to improve it by copying the shape of
the spreaded object:
```
const x = { a: 1, b: 2 };
const y = {}; y.a = 1; y.b = 2;
const xCopied = { ...x };
const yCopied = { ...y };
console.log(%HaveSameMap(x, xCopied)); // expected: TRUE
console.log(%HaveSameMap(y, yCopied)); // true
```
Thanks!
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/v8-dev/acee88e1-854a-491b-bf3b-cefa38364d80n%40googlegroups.com.