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

Side by Side Diff: test/mjsunit/harmony/object-literals-super.js

Issue 1135243004: [es6] Support super.property in eval and arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-classes --allow-natives-syntax 5 // Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax
6 6
7 7
8 (function TestHomeObject() { 8 (function TestHomeObject() {
9 var object = { 9 var object = {
10 method() { 10 method() {
11 return super.method(); 11 return super.method();
12 }, 12 },
13 get getter() { 13 get getter() {
14 return super.getter; 14 return super.getter;
15 }, 15 },
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return 42; 124 return 42;
125 } 125 }
126 }, 126 },
127 *g() { 127 *g() {
128 yield super.m(); 128 yield super.m();
129 }, 129 },
130 }; 130 };
131 131
132 assertEquals(42, o.g().next().value); 132 assertEquals(42, o.g().next().value);
133 })(); 133 })();
134
135
136 (function TestSuperPropertyInEval() {
137 var y = 3;
138 var p = {
139 m() { return 1; },
140 get x() { return 2; },
141 set y(v) { y = v; }
142 };
143 var o = {
144 __proto__: p,
145 eval() {
146 assertSame(super.x, eval('super.x'));
147 assertSame(super.m(), eval('super.m()'));
148 // Global eval.
149 assertThrows('super.x', SyntaxError);
150 assertThrows('super.m()', SyntaxError);
151 return eval('super.m()');
152 },
153 arrow() {
154 assertSame(super.x, (() => super.x)());
155 assertSame(super.m(), (() => super.m())());
156 return (() => super.m())();
157 }
158 };
159 assertSame(1, o.eval());
160 assertSame(1, o.arrow());
161 })();
OLDNEW
« src/ast.h ('K') | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698