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()); |
+ |
+})(); |