| Index: test/mjsunit/harmony/arrow-functions-scoping.js
|
| diff --git a/test/mjsunit/harmony/arrow-functions-scoping.js b/test/mjsunit/harmony/arrow-functions-scoping.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c3245274f9cffd7c222de4b6cae7b081f30dcb3f
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/arrow-functions-scoping.js
|
| @@ -0,0 +1,28 @@
|
| +// Copyright 2015 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Flags: --harmony-arrow-functions
|
| +
|
| +// The following are tests from:
|
| +// http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax
|
| +var obj = {
|
| + method: function () {
|
| + return () => this;
|
| + }
|
| +};
|
| +assertSame(obj, obj.method()());
|
| +
|
| +var fake = { steal: obj.method() };
|
| +assertSame(obj, fake.steal());
|
| +
|
| +var real = { borrow: obj.method };
|
| +assertSame(real, real.borrow()());
|
| +
|
| +// Same, but using eval() for the arrow function.
|
| +obj = {
|
| + method: function () {
|
| + return eval("() => this");
|
| + }
|
| +};
|
| +assertSame(obj, obj.method()());
|
|
|