summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js')
-rw-r--r--js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js
new file mode 100644
index 0000000000..2a9da1e1f9
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/statements/try/catch-redeclared-for-of-var.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2019 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+author: Ross Kirsling
+esid: sec-variablestatements-in-catch-blocks
+description: Re-declaration of catch parameter (for-of statement)
+info: |
+ It is a Syntax Error if any element of the BoundNames of CatchParameter
+ also occurs in the VarDeclaredNames of Block, unless CatchParameter is
+ CatchParameter : BindingIdentifier.
+---*/
+
+var before, during, after;
+
+try {
+ throw 'exception';
+} catch (err) {
+ before = err;
+ for (var err of [2]) {
+ during = err;
+ }
+ after = err;
+}
+
+assert.sameValue(before, 'exception');
+assert.sameValue(during, 2, 'during loop body evaluation');
+assert.sameValue(after, 2, 'after loop body evaluation');
+
+reportCompare(0, 0);