OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --harmony-arrow-functions |
| 6 |
| 7 // The following are tests from: |
| 8 // http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax |
| 9 var obj = { |
| 10 method: function () { |
| 11 return () => this; |
| 12 } |
| 13 }; |
| 14 assertSame(obj, obj.method()()); |
| 15 |
| 16 var fake = { steal: obj.method() }; |
| 17 assertSame(obj, fake.steal()); |
| 18 |
| 19 var real = { borrow: obj.method }; |
| 20 assertSame(real, real.borrow()()); |
| 21 |
| 22 // Same, but using eval() for the arrow function. |
| 23 obj = { |
| 24 method: function () { |
| 25 return eval("() => this"); |
| 26 } |
| 27 }; |
| 28 assertSame(obj, obj.method()()); |
OLD | NEW |