Bug 1185106 - Part 9.3: Add parser test for yield in async function statement in export default. r=till
authorTooru Fujisawa <arai_a@mac.com>
Sun, 28 Aug 2016 23:58:29 +0900
changeset 320242 fe120f64b871c96744c63d6530f41f83022511c2
parent 320241 e042b0dba45525afea60180c2851bee4785a1855
child 320243 3a03d945279843d6eaa80ff56af174e0b45abf7d
push id20754
push usercbook@mozilla.com
push dateMon, 31 Oct 2016 15:58:35 +0000
treeherderfx-team@b1b66b1780c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstill
bugs1185106
milestone52.0a1
Bug 1185106 - Part 9.3: Add parser test for yield in async function statement in export default. r=till MozReview-Commit-ID: 3OsdBSSyz64
js/src/tests/ecma_7/AsyncFunctions/syntax-modules.js
js/src/tests/ecma_7/AsyncFunctions/yield.js
--- a/js/src/tests/ecma_7/AsyncFunctions/syntax-modules.js
+++ b/js/src/tests/ecma_7/AsyncFunctions/syntax-modules.js
@@ -4,12 +4,17 @@ var summary = "async/await syntax in mod
 print(BUGNUMBER + ": " + summary);
 
 if (typeof parseModule === "function") {
     parseModule("async function f() { await 3; }");
     parseModule("async function f() { await 3; }");
     assertThrows(() => parseModule("var await = 5;"), SyntaxError);
     assertThrows(() => parseModule("export var await;"), SyntaxError);
     assertThrows(() => parseModule("async function f() { function g() { await 3; } }"), SyntaxError);
+
+    if (typeof Reflect !== "undefined" && Reflect.parse) {
+        assertThrows(() => Reflect.parse("export default async function() { yield; }", { target: "module" }), SyntaxError);
+        assertThrows(() => Reflect.parse("export default async function() { yield = 1; }", { target: "module" }), SyntaxError);
+    }
 }
 
 if (typeof reportCompare === "function")
     reportCompare(true, true);
--- a/js/src/tests/ecma_7/AsyncFunctions/yield.js
+++ b/js/src/tests/ecma_7/AsyncFunctions/yield.js
@@ -17,16 +17,17 @@ function testErrorArgsBody(argsbody, pre
     assertThrows(() => Reflect.parse(`${prefix} ({ async m${argsbody} })`), SyntaxError);
 }
 
 function testErrorArgsBodyStrict(argsbody) {
     testErrorArgsBody(argsbody);
     testErrorArgsBody(argsbody, "'use strict'; ");
     assertThrows(() => Reflect.parse(`class X { async m${argsbody} }`), SyntaxError);
     assertThrows(() => Reflect.parse(`class X { static async m${argsbody} }`), SyntaxError);
+    assertThrows(() => Reflect.parse(`export default async function ${argsbody}`, { target: "module" }), SyntaxError);
 }
 
 if (typeof Reflect !== "undefined" && Reflect.parse) {
     // `yield` handling is inherited in async function declaration name.
     Reflect.parse("async function yield() {}");
     Reflect.parse("function f() { async function yield() {} }");
     assertThrows(() => Reflect.parse("function* g() { async function yield() {} }"), SyntaxError);
     assertThrows(() => Reflect.parse("'use strict'; async function yield() {}"), SyntaxError);