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

Unified Diff: test/mjsunit/es6/classes.js

Issue 1952633002: [full-codegen] Introduce NestedStatement subclass for class literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More tests Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/classes.js
diff --git a/test/mjsunit/es6/classes.js b/test/mjsunit/es6/classes.js
index 2684d53ff65b9c089042ed37d97996ea5e2806e1..fb77dbb8e4b01bb273512b215763dadbb1077661 100644
--- a/test/mjsunit/es6/classes.js
+++ b/test/mjsunit/es6/classes.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --allow-natives-syntax
+// Flags: --allow-natives-syntax --harmony-do-expressions
(function TestBasics() {
var C = class C {}
@@ -994,3 +994,55 @@ function testClassRestrictedProperties(C) {
testClassRestrictedProperties(
class extends Class { constructor() { super(); } });
})();
+
+
+(function testReturnFromClassLiteral() {
+
+ function usingDoExpressionInBody() {
+ let x = 42;
+ let dummy = function() {x};
+ try {
+ class C {
+ dummy() {C}
+ [do {return}]() {}
+ };
+ } finally {
+ return x;
+ }
+ }
+ assertEquals(42, usingDoExpressionInBody());
+
+ function usingDoExpressionInExtends() {
+ let x = 42;
+ let dummy = function() {x};
+ try {
+ class C extends (do {return}) { dummy() {C} };
+ } finally {
+ return x;
+ }
+ }
+ assertEquals(42, usingDoExpressionInExtends());
+
+ function usingYieldInBody() {
+ function* foo() {
+ class C {
+ [yield]() {}
+ }
+ }
+ var g = foo();
+ g.next();
+ return g.return(42).value;
+ }
+ assertEquals(42, usingYieldInBody());
+
+ function usingYieldInExtends() {
+ function* foo() {
+ class C extends (yield) {};
+ }
+ var g = foo();
+ g.next();
+ return g.return(42).value;
+ }
+ assertEquals(42, usingYieldInExtends());
+
+})();
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698