forked from v8/v8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged: [runtime] Fix object cloning with spreads
When cloning objects using spread and update properties (e.g. obj = {...o, x: 0}), we wrongly used the setter for the update argument if one was set. This CL changes the behaviour such that all arguments following the spread are treated as dynamic arguments. (cherry picked from commit 732d09a) Bug: chromium:1251366 No-Try: true No-Presubmit: true No-Tree-Checks: true Change-Id: Ie71dbe3f420a68e5e7e7aa23bc3ef8caccf6180c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3219081 Reviewed-by: Deepti Gandluri <gdeepti@chromium.org> Commit-Queue: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/branch-heads/9.5@{v8#40} Cr-Branched-From: 4a03d61-refs/heads/9.5.172@{#1} Cr-Branched-From: 9a60704-refs/heads/main@{#76741}
- Loading branch information
Patrick Thier
authored and
V8 LUCI CQ
committed
Oct 12, 2021
1 parent
9310dae
commit 813333d
Showing
2 changed files
with
101 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2021 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
Object.defineProperty(Object.prototype, "x", { | ||
set: function (val) {} | ||
}); | ||
|
||
let o = {...{}, x: 3}; | ||
assertEquals(o.x, 3); | ||
|
||
let o2 = {...{x: 1}, x: 3}; | ||
assertEquals(o2.x, 3); |