| 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..8a123276818bce8ba77efc045f1dc65d929470a2
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/arrow-functions-scoping.js
|
| @@ -0,0 +1,23 @@
|
| +// 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
|
| +
|
| +// ''=>'' has only lexical ''this'', no dynamic ''this''
|
| +var obj = {
|
| + method: function () {
|
| + return () => this;
|
| + }
|
| +};
|
| +assertSame(obj, obj.method()());
|
| +
|
| +var fake = {steal: obj.method()};
|
| +assertSame(obj, fake.steal());
|
| +
|
| +// But ''function'' still has dynamic ''this'' of course
|
| +var real = {borrow: obj.method};
|
| +assertSame(real, real.borrow()());
|
|
|