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

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: Make sure an unresolved VariableProxy for "this" is not considered a valid LHS Created 5 years, 11 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
« src/scopes.cc ('K') | « test/cctest/test-parsing.cc ('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()());
OLDNEW
« src/scopes.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698