OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-proxies --harmony-reflect | |
6 | |
7 | 5 |
8 function sloppyDefaultSet(o, p, v) { return o[p] = v } | 6 function sloppyDefaultSet(o, p, v) { return o[p] = v } |
9 function sloppyReflectSet(o, p, v) { return Reflect.set(o, p, v) } | 7 function sloppyReflectSet(o, p, v) { return Reflect.set(o, p, v) } |
10 function strictDefaultSet(o, p, v) { "use strict"; return o[p] = v } | 8 function strictDefaultSet(o, p, v) { "use strict"; return o[p] = v } |
11 function strictReflectSet(o, p, v) { "use strict"; return Reflect.set(o, p, v) } | 9 function strictReflectSet(o, p, v) { "use strict"; return Reflect.set(o, p, v) } |
12 | 10 |
13 sloppyDefaultSet.shouldThrow = false; | 11 sloppyDefaultSet.shouldThrow = false; |
14 sloppyReflectSet.shouldThrow = false; | 12 sloppyReflectSet.shouldThrow = false; |
15 strictDefaultSet.shouldThrow = true; | 13 strictDefaultSet.shouldThrow = true; |
16 strictReflectSet.shouldThrow = false; | 14 strictReflectSet.shouldThrow = false; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 for (var receiver of [null, undefined, 1]) { | 301 for (var receiver of [null, undefined, 1]) { |
304 Reflect.set(object, p, 42, receiver); | 302 Reflect.set(object, p, 42, receiver); |
305 assertEquals(1, observations.length); | 303 assertEquals(1, observations.length); |
306 assertArrayEquals([target, toKey(p), 42, receiver], observations[0]); | 304 assertArrayEquals([target, toKey(p), 42, receiver], observations[0]); |
307 assertSame(target, observations[0][0]); | 305 assertSame(target, observations[0][0]); |
308 assertSame(receiver, observations[0][3]); | 306 assertSame(receiver, observations[0][3]); |
309 observations = []; | 307 observations = []; |
310 } | 308 } |
311 } | 309 } |
312 })(); | 310 })(); |
OLD | NEW |