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-arrow-functions | |
6 | |
7 var object = {}; | 5 var object = {}; |
8 var global = this; | 6 var global = this; |
9 var call = Function.call.bind(Function.call); | 7 var call = Function.call.bind(Function.call); |
10 | 8 |
11 var globalSloppyArrow = () => this; | 9 var globalSloppyArrow = () => this; |
12 var globalStrictArrow = () => { "use strict"; return this; }; | 10 var globalStrictArrow = () => { "use strict"; return this; }; |
13 var globalSloppyArrowEval = (s) => eval(s); | 11 var globalSloppyArrowEval = (s) => eval(s); |
14 var globalStrictArrowEval = (s) => { "use strict"; return eval(s); }; | 12 var globalStrictArrowEval = (s) => { "use strict"; return eval(s); }; |
15 | 13 |
16 var sloppyFunctionArrow = function() { | 14 var sloppyFunctionArrow = function() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 call(strictFunctionArrowEval, object, "(() => this)()")); | 70 call(strictFunctionArrowEval, object, "(() => this)()")); |
73 assertEquals(undefined, | 71 assertEquals(undefined, |
74 call(strictFunctionArrowEval, undefined, "(() => this)()")); | 72 call(strictFunctionArrowEval, undefined, "(() => this)()")); |
75 | 73 |
76 assertEquals(global, call(arrowInsideWith, undefined)); | 74 assertEquals(global, call(arrowInsideWith, undefined)); |
77 assertEquals(global, call(arrowInsideWith, object)); | 75 assertEquals(global, call(arrowInsideWith, object)); |
78 assertEquals(global, call(arrowInsideWithEval, undefined, "this")); | 76 assertEquals(global, call(arrowInsideWithEval, undefined, "this")); |
79 assertEquals(global, call(arrowInsideWithEval, object, "this")); | 77 assertEquals(global, call(arrowInsideWithEval, object, "this")); |
80 assertEquals(global, call(arrowInsideWithEval, undefined, "(() => this)()")); | 78 assertEquals(global, call(arrowInsideWithEval, undefined, "(() => this)()")); |
81 assertEquals(global, call(arrowInsideWithEval, object, "(() => this)()")); | 79 assertEquals(global, call(arrowInsideWithEval, object, "(() => this)()")); |
OLD | NEW |