forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray-props2.js
More file actions
26 lines (22 loc) · 808 Bytes
/
array-props2.js
File metadata and controls
26 lines (22 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* 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 -non-strict -O -target=HBC %s | %FileCheck --match-full-lines %s
// RUN: %hermes -non-strict -O -target=HBC -emit-binary -out %t.hbc %s && %hermes %t.hbc | %FileCheck --match-full-lines %s
x = Array(5);
print(x);
//CHECK: ,,,,
p = x.__proto__;
Object.defineProperty(p, "7", {get: function() { return 10; }, set: function (v) {
print("set1", v); }});
Object.defineProperty(p, "2", {get: function() { return 9; }, set: function (v) {
print("set2", v); }});
x[2] = 100;
//CHECK-NEXT: set2 100
x[7] = 101;
//CHECK-NEXT: set1 101
print(x[0], x[2], x[7], x.length);
//CHECK-NEXT: undefined 9 10 5