Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: test/mjsunit/harmony/arrow-functions-scoping.js

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased against master, plus fixes. Only 4 tests failing (+2 in TurboFan) Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-scopes.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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()());
29
30 // Using eval() to define the whole object.
31 eval('obj = { method: function () { return () => this } }');
32 assertSame(obj, obj.method()());
33
34 // Nested eval().
35 eval('obj = { method: function () { return eval("() => this") } }');
36 assertSame(obj, obj.method()());
OLDNEW
« no previous file with comments | « test/mjsunit/debug-scopes.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698