forked from facebook/hermes
-
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.
Use DefineOwnComputed in arraySpread.
Summary: It's incorrect to use putComputed in array spread to populate the array, as the spec requires [[DefineOwnComputed]]. Reviewed By: Huxpro Differential Revision: D23378314 fbshipit-source-id: 48b67c23e9ab14d2c3e85cb6d6ccec870c61780f
- Loading branch information
1 parent
40dc587
commit b944a99
Showing
2 changed files
with
30 additions
and
3 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,19 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// RUN: %hermes -O %s | %FileCheck --match-full-lines %s | ||
// RUN: %hermes -O -emit-binary -out %t.hbc %s && %hermes %t.hbc | %FileCheck --match-full-lines %s | ||
|
||
// Ensure that overriding slots in the array prototype doesn't break spread, | ||
// because array spreading uses DefineOwnProperty. | ||
Object.defineProperty(Array.prototype, 0, {}); | ||
|
||
print([..."asd"]) | ||
// CHECK: a,s,d | ||
|
||
print([...['a', 's', 'd']]) | ||
// CHECK: a,s,d |