summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Generators
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 14:51:46 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:14 -0400
commit7ecc50d90d13690d610f26d0056a326e52bc834c (patch)
tree18e5e9248a8011e44de84cb8b73f77f9027d0dd6 /js/src/tests/ecma_6/Generators
parent987d6726f3c64d1cc510acba1de08deb5e0a7702 (diff)
downloadUXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.gz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.lz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.tar.xz
UXP-7ecc50d90d13690d610f26d0056a326e52bc834c.zip
1317379 - Disallow generator functions and async functions as direct children of if/else.
Diffstat (limited to 'js/src/tests/ecma_6/Generators')
-rw-r--r--js/src/tests/ecma_6/Generators/forbidden-as-consequent.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Generators/forbidden-as-consequent.js b/js/src/tests/ecma_6/Generators/forbidden-as-consequent.js
new file mode 100644
index 000000000..13647e154
--- /dev/null
+++ b/js/src/tests/ecma_6/Generators/forbidden-as-consequent.js
@@ -0,0 +1,11 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+assertThrowsInstanceOf(() => eval("if (1) function* foo() {}"),
+ SyntaxError);
+assertThrowsInstanceOf(() => eval("'use strict'; if (1) function* foo() {}"),
+ SyntaxError);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);