summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/switch
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/switch')
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js75
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js89
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js93
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js83
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js33
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js30
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js30
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js16
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js32
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js31
-rw-r--r--js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js36
-rw-r--r--js/src/tests/test262/language/statements/switch/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js58
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js68
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js26
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js66
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js82
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-b-final.js80
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js51
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js68
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js84
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js69
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js82
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js71
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js59
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-dflt-final.js70
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js55
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js67
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js51
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js72
-rw-r--r--js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js44
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-async-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-close-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js48
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-generator.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-open-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js31
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-var-none-case.js34
-rw-r--r--js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js33
-rw-r--r--js/src/tests/test262/language/statements/switch/shell.js16
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js24
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js18
-rw-r--r--js/src/tests/test262/language/statements/switch/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-case-body-strict.js23
-rw-r--r--js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js23
117 files changed, 3849 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js
new file mode 100644
index 0000000000..7313278b82
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T1.js
@@ -0,0 +1,75 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T1
+description: Simple test using switch statement
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 4)){
+ throw new Test262Error("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 56)){
+ throw new Test262Error("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 64)){
+ throw new Test262Error("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 32)){
+ throw new Test262Error("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 32)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest('0') === 32)){
+ throw new Test262Error("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js
new file mode 100644
index 0000000000..43e524e89c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T2.js
@@ -0,0 +1,89 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T2
+description: Switch with different types of variables
+---*/
+
+var x = new Number(2);
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case '1':
+ result += 4;
+ break;
+ case new Number(2):
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ break;
+ case x:
+ result += 128;
+ break;
+ case 0:
+ result += 256;
+ case 1:
+ result += 512;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 512)){
+ throw new Test262Error("#2: SwitchTest(1) === 512. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 32)){
+ throw new Test262Error("#3: SwitchTest(2) === 32. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 64)){
+ throw new Test262Error("#5: SwitchTest(4) === 64. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 32)){
+ throw new Test262Error("#8: SwitchTest(null) === 32. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 32)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 32. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest('0') === 32)){
+ throw new Test262Error("#10: SwitchTest('0') === 32. Actual: SwitchTest('0') ==="+ SwitchTest('0') );
+}
+
+if(!(SwitchTest(x) === 128)){
+ throw new Test262Error("#10: SwitchTest(x) === 128. Actual: SwitchTest(x) ==="+ SwitchTest(x) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js
new file mode 100644
index 0000000000..62298e3d65
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T3.js
@@ -0,0 +1,93 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T3
+description: Using case with null, NaN, Infinity
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case null:
+ result += 64;
+ case NaN:
+ result += 128;
+ break;
+ case Infinity:
+ result += 256;
+ case 2+3:
+ result += 512;
+ break;
+ case undefined:
+ result += 1024;
+ }
+
+ return result;
+}
+
+if(!(SwitchTest(0) === 6)){
+ throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+}
+
+if(!(SwitchTest(1) === 4)){
+ throw new Test262Error("#2: SwitchTest(1) === 4. Actual: SwitchTest(1) ==="+ SwitchTest(1) );
+}
+
+if(!(SwitchTest(2) === 56)){
+ throw new Test262Error("#3: SwitchTest(2) === 56. Actual: SwitchTest(2) ==="+ SwitchTest(2) );
+}
+
+if(!(SwitchTest(3) === 48)){
+ throw new Test262Error("#4: SwitchTest(3) === 48. Actual: SwitchTest(3) ==="+ SwitchTest(3) );
+}
+
+if(!(SwitchTest(4) === 32)){
+ throw new Test262Error("#5: SwitchTest(4) === 32. Actual: SwitchTest(4) ==="+ SwitchTest(4) );
+}
+
+if(!(SwitchTest(5) === 512)){
+ throw new Test262Error("#5: SwitchTest(5) === 512. Actual: SwitchTest(5) ==="+ SwitchTest(5) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 32)){
+ throw new Test262Error("#7: SwitchTest(false) === 32. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 192)){
+ throw new Test262Error("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 1024)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest(NaN) === 32)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+if(!(SwitchTest(Infinity) === 768)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js b/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js
new file mode 100644
index 0000000000..8d2c19f49e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A1_T4.js
@@ -0,0 +1,83 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If Result.type is break and Result.target is in the current
+ label set, return (normal, Result.value, empty)
+es5id: 12.11_A1_T4
+description: Using case with isNaN and isNaN(value)
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case isNaN(value):
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case null:
+ result += 64;
+ case isNaN:
+ result += 128;
+ break;
+ case Infinity:
+ result += 256;
+ case 2+3:
+ result += 512;
+ break;
+ case undefined:
+ result += 1024;
+ }
+
+ return result;
+}
+
+var n = Number(false);
+
+if(!(SwitchTest(n) === 6)){
+ throw new Test262Error("#1: SwitchTest(Number(false)) === 6. Actual: SwitchTest(Number(false)) ==="+ SwitchTest(n) );
+}
+
+if(!(SwitchTest(parseInt) === 32)){
+ throw new Test262Error("#2: SwitchTest(parseInt) === 32. Actual: SwitchTest(parseInt) ==="+ SwitchTest(parseInt) );
+}
+
+if(!(SwitchTest(isNaN) === 128)){
+ throw new Test262Error("#3: SwitchTest(isNaN) === 128. Actual: SwitchTest(isNaN) ==="+ SwitchTest(isNaN) );
+}
+
+if(!(SwitchTest(true) === 32)){
+ throw new Test262Error("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
+}
+
+if(!(SwitchTest(false) === 48)){
+ throw new Test262Error("#7: SwitchTest(false) === 48. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
+}
+
+if(!(SwitchTest(null) === 192)){
+ throw new Test262Error("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
+}
+
+if(!(SwitchTest(void 0) === 1024)){
+ throw new Test262Error("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
+}
+
+if(!(SwitchTest(NaN) === 32)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+if(!(SwitchTest(Infinity) === 768)){
+ throw new Test262Error("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js
new file mode 100644
index 0000000000..293fcf6181
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A2_T1.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: There can be only one DefaultClause
+es5id: 12.11_A2_T1
+description: Duplicate DefaultClause
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js
new file mode 100644
index 0000000000..80e2a8c7e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T1.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T1
+description: Checking if execution of "switch() {}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch() {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js
new file mode 100644
index 0000000000..2605e24aa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T2.js
@@ -0,0 +1,30 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T2
+description: Checking if execution of "switch {}" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch {
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js
new file mode 100644
index 0000000000..f946e094eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T3.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T3
+description: Checking if execution of "switch(value)" fails
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+switch(value);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js
new file mode 100644
index 0000000000..369011c9a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T4.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T4
+description: >
+ Using "case" that has no Expresson after it. "CaseClause: case
+ Expression : [StatementList]"
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js b/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js
new file mode 100644
index 0000000000..6439de051a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A3_T5.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Syntax constructions of switch statement
+es5id: 12.11_A3_T5
+description: Introducing statement not followed by "case" keyword
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ result =2;
+ case 0:
+ result += 2;
+ default:
+ result += 32;
+ break;
+ }
+
+ return result;
+}
+
+var x = SwitchTest(0);
diff --git a/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js b/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js
new file mode 100644
index 0000000000..2588709288
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/S12.11_A4_T1.js
@@ -0,0 +1,36 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Embedded syntax constructions of switch statement
+es5id: 12.11_A4_T1
+description: Nesting one "switch" statement into StatementList of the other's
+---*/
+
+function SwitchTest(value){
+ var result = 0;
+
+ switch(value) {
+ case 0:
+ switch(value) {
+ case 0:
+ result += 3;
+ break;
+ default:
+ result += 32;
+ break;
+ }
+ result *= 2;
+ break;
+ result=3;
+ default:
+ result += 32;
+ break;
+ }
+ return result;
+}
+
+var x = SwitchTest(0);
+if(x!==6) throw new Test262Error("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/browser.js b/js/src/tests/test262/language/statements/switch/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js
new file mode 100644
index 0000000000..2bd948fd21
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-abrupt-empty.js
@@ -0,0 +1,58 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": break; default: }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { case "a": { 3; break; } default: }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { case "a": continue; default: } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { case "a": { 6; continue; } default: } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..8fa4a1b125
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-abrupt-empty.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; break; default: }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; break; default: }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": break; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; case "b": 10; continue; default: } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": case "b": 12; continue; default: } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; case "b": continue; default: } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js
new file mode 100644
index 0000000000..2bc7e5f0de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-a-fall-thru-nrml.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ [...]
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ [...]
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js
new file mode 100644
index 0000000000..b866c73b6d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-abrupt-empty.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when case block is empty
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { }
+
+ 1. Return NormalCompletion(undefined).
+---*/
+
+assert.sameValue(eval('1; switch(null) {}'), undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js
new file mode 100644
index 0000000000..7e3b0ef97b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-abrupt-empty.js
@@ -0,0 +1,66 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": break; }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "a": { 3; break; } }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: case "a": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: case "a": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..59d82a569b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-abrupt-empty.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": 2; case "b": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "a": case "b": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "a": 7; case "b": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { default: case "a": 9; case "b": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { default: case "a": case "b": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { default: case "a": 14; case "b": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js
new file mode 100644
index 0000000000..2555aedb54
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-fall-thru-nrml.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+ 8. If foundInB is true, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": 2; case "b": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "a": case "b": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "a": 7; case "b": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-b-final.js b/js/src/tests/test262/language/statements/switch/cptn-b-final.js
new file mode 100644
index 0000000000..90b0419e13
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-b-final.js
@@ -0,0 +1,80 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ 2. If clauseSelector is an abrupt completion, then
+ a. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ b. Else, return Completion(clauseSelector).
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ 1. Let R be the result of evaluating CaseClause C.
+ 2. If R.[[value]] is not empty, let V = R.[[value]].
+ 3. If R is an abrupt completion, return
+ Completion(UpdateEmpty(R, V)).
+ 8. If foundInB is true, return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "a": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "a": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { default: case "a": case "b": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { default: case "a": case "b": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { default: case "a": 8; case "b": }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { default: case "a": 10; case "b": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js
new file mode 100644
index 0000000000..fc15af1398
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-abrupt-empty.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the default case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(eval('1; switch ("a") { default: break; }'), undefined);
+assert.sameValue(eval('2; switch ("a") { default: { 3; break; } }'), 3);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: { continue; } } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js
new file mode 100644
index 0000000000..567900f159
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-abrupt-empty.js
@@ -0,0 +1,68 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": break; }'), undefined
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "b": { 3; break; } }'), 3
+);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { default: case "b": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { default: case "b": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..c37bd4b442
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-abrupt-empty.js
@@ -0,0 +1,84 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": 2; case "c": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "b": 7; case "c": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { default: case "b": 9; case "c": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { default: case "b": case "c": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { default: case "b": 14; case "c": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js
new file mode 100644
index 0000000000..1a342ccdc5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-fall-thru-nrml.js
@@ -0,0 +1,69 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": 2; case "c": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { default: case "b": 7; case "c": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js
new file mode 100644
index 0000000000..a1ddd7dd7e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-b-final.js
@@ -0,0 +1,82 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ i. If foundInB is false, then
+ 1. Let clauseSelector be the result of CaseSelectorEvaluation of
+ C.
+ [...]
+ 3. Let foundInB be the result of performing Strict Equality
+ Comparison input === clauseSelector.[[value]].
+ ii. If foundInB is true, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ a. Let R be the result of evaluating CaseClause C.
+ b. If R.[[value]] is not empty, let V = R.[[value]].
+ c. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: case "b": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: case "b": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("a") { default: case "b": case "c": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("a") { default: case "b": case "c": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("a") { default: case "b": 8; case "c": }'),
+ 8,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("a") { default: case "b": 10; case "c": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..44d369ad25
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-abrupt-empty.js
@@ -0,0 +1,71 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion in the default case
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; default: 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": default: 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; default: continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js
new file mode 100644
index 0000000000..42f52df835
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-fall-thru-nrml.js
@@ -0,0 +1,59 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion in the default case
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClausesopt DefaultClause CaseClausesopt }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ 11. If R is an abrupt completion, return Completion(UpdateEmpty(R, V)).
+ 12. Repeat for each CaseClause C in B (NOTE this is another complete
+ iteration of the second CaseClauses)
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; default: 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": default: 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; default: }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js b/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js
new file mode 100644
index 0000000000..7099e69f59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-dflt-final.js
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when the default case matches and is final
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the list of CaseClause items in the first CaseClauses, in
+ source text order. If the first CaseClauses is not present A is « ».
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A
+ [...]
+ 5. Let foundInB be false.
+ 6. Let B be the List containing the CaseClause items in the second
+ CaseClauses, in source text order. If the second CaseClauses is not
+ present B is « ».
+ 7. If found is false, then
+ a. Repeat for each CaseClause C in B
+ [...]
+ 8. If foundInB is true, return NormalCompletion(V).
+ 9. Let R be the result of evaluating DefaultClause.
+ 10. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 13. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { default: }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { default: 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { case "a": default: }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { case "a": default: 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { case "a": 8; default: }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { case "a": 10; default: 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js
new file mode 100644
index 0000000000..cf640d6b90
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-abrupt-empty.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when the matching case is exited via an empty abrupt
+ completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(eval('1; switch ("a") { case "a": break; }'), undefined);
+assert.sameValue(eval('2; switch ("a") { case "a": { 3; break; } }'), 3);
+
+assert.sameValue(
+ eval('4; do { switch ("a") { case "a": continue; } } while (false)'),
+ undefined
+);
+assert.sameValue(
+ eval('5; do { switch ("a") { case "a": { 6; continue; } } } while (false)'),
+ 6
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js
new file mode 100644
index 0000000000..4abf4d3e8a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-abrupt-empty.js
@@ -0,0 +1,67 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with an empty abrupt completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; break; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; break; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": break; }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+assert.sameValue(
+ eval('8; do { switch ("a") { case "a": 9; case "b": 10; continue; } } while (false)'),
+ 10,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('11; do { switch ("a") { case "a": case "b": 12; continue; } } while (false)'),
+ 12,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('13; do { switch ("a") { case "a": 14; case "b": continue; } } while (false)'),
+ 14,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js
new file mode 100644
index 0000000000..594945d7db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-fall-thru-nrml.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: >
+ Completion value when execution continues through multiple cases and ends
+ with a normal completion
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ [...]
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ [...]
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": 2; case "b": 3; }'),
+ 3,
+ 'Non-empty value replaces previous non-empty value'
+);
+assert.sameValue(
+ eval('4; switch ("a") { case "a": case "b": 5; }'),
+ 5,
+ 'Non-empty value replaces empty value'
+);
+assert.sameValue(
+ eval('6; switch ("a") { case "a": 7; case "b": }'),
+ 7,
+ 'Empty value does not replace previous non-empty value'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js
new file mode 100644
index 0000000000..4eb34f8cae
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-match-final.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when only the final case matches
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ 1. If clauseSelector.[[value]] is empty, return
+ Completion{[[type]]: clauseSelector.[[type]], [[value]]:
+ undefined, [[target]]: clauseSelector.[[target]]}.
+ 2. Else, return Completion(clauseSelector).
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ i. Let R be the result of evaluating C.
+ ii. If R.[[value]] is not empty, let V = R.[[value]].
+ iii. If R is an abrupt completion, return Completion(UpdateEmpty(R,
+ V)).
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case "a": }'),
+ undefined,
+ 'empty StatementList (lone case)'
+);
+assert.sameValue(
+ eval('2; switch ("a") { case "a": 3; }'),
+ 3,
+ 'non-empy StatementList (lone case)'
+);
+assert.sameValue(
+ eval('4; switch ("b") { case "a": case "b": }'),
+ undefined,
+ 'empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('5; switch ("b") { case "a": case "b": 6; }'),
+ 6,
+ 'non-empty StatementList (following an empty case)'
+);
+assert.sameValue(
+ eval('7; switch ("b") { case "a": 8; case "b": }'),
+ undefined,
+ 'empty StatementList (following a non-empty case)'
+);
+assert.sameValue(
+ eval('9; switch ("b") { case "a": 10; case "b": 11; }'),
+ 11,
+ 'non-empty StatementList (following a non-empty case)'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js
new file mode 100644
index 0000000000..83ff4ad846
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/cptn-no-dflt-no-match.js
@@ -0,0 +1,44 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 13.12.11
+description: Completion value when no cases match
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ [...]
+ 8. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ 9. Set the running execution context’s LexicalEnvironment to oldEnv.
+ 10. Return R.
+
+ 13.12.9 Runtime Semantics: CaseBlockEvaluation
+
+ CaseBlock : { CaseClauses }
+
+ 1. Let V = undefined.
+ 2. Let A be the List of CaseClause items in CaseClauses, in source text
+ order.
+ 3. Let found be false.
+ 4. Repeat for each CaseClause C in A,
+ a. If found is false, then
+ i. Let clauseSelector be the result of CaseSelectorEvaluation of C.
+ ii. If clauseSelector is an abrupt completion, then
+ [...]
+ iii. Let found be the result of performing Strict Equality Comparison
+ input === clauseSelector.[[value]].
+ b. If found is true, then
+ [...]
+ 5. Return NormalCompletion(V).
+---*/
+
+assert.sameValue(
+ eval('1; switch ("a") { case null: }'), undefined, 'empty StatementList'
+);
+assert.sameValue(
+ eval('2; switch ("a") { case null: 3; }'),
+ undefined,
+ 'non-empty StatementList'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js b/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js
new file mode 100644
index 0000000000..737ab103b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-async-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: async function x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js b/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js
new file mode 100644
index 0000000000..7b1dc835e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-async-generator.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: async function * x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-class.js b/js/src/tests/test262/language/statements/switch/scope-lex-class.js
new file mode 100644
index 0000000000..7cbf564b0a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: class x {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js b/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js
new file mode 100644
index 0000000000..beca515ece
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-close-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Removal of lexical environment (from `case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probe1, probe2;
+
+switch (null) {
+ case null:
+ let x = 'inside';
+ probe1 = function() { return x; };
+ case null:
+ probe2 = function() { return x; };
+}
+
+assert.sameValue(probe1(), 'inside', 'from first `case` clause');
+assert.sameValue(probe2(), 'inside', 'from second `case` clause');
+assert.sameValue(x, 'outside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js b/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js
new file mode 100644
index 0000000000..e46fae794e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-close-dflt.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Removal of lexical environment (from `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeDefault, probeDefaultBeforeCase, probeCase;
+
+switch (null) {
+ default:
+ let x = 'inside';
+ probeDefault = function() { return x; };
+}
+
+assert.sameValue(probeDefault(), 'inside', 'from lone `default` clause`');
+assert.sameValue(x, 'outside');
+
+switch (null) {
+ default:
+ let x = 'inside';
+ probeDefaultBeforeCase = function() { return x; };
+ case 0:
+ probeCase = function() { return x; };
+}
+
+assert.sameValue(
+ probeDefaultBeforeCase(),
+ 'inside',
+ 'from `default` clause preceding `case` clause'
+);
+assert.sameValue(
+ probeCase(), 'inside', 'from `case` clause following `default` clause'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-const.js b/js/src/tests/test262/language/statements/switch/scope-lex-const.js
new file mode 100644
index 0000000000..27a1adcc29
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: const x = 1; }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-generator.js b/js/src/tests/test262/language/statements/switch/scope-lex-generator.js
new file mode 100644
index 0000000000..1e417855b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-generator.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: function * x() {} }
+x;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-let.js b/js/src/tests/test262/language/statements/switch/scope-lex-let.js
new file mode 100644
index 0000000000..791d69c4c7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:ReferenceError
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+negative:
+ phase: runtime
+ type: ReferenceError
+---*/
+
+switch (0) { default: /*{ body }*/ }
+f;
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js b/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js
new file mode 100644
index 0000000000..e9360c40fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-open-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeExpr, probeSelector, probeStmt;
+
+switch (probeExpr = function() { return x; }, null) {
+ case probeSelector = function() { return x; }, null:
+ probeStmt = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeExpr(), 'outside');
+assert.sameValue(
+ probeSelector(), 'inside', 'reference from "selector" Expression'
+);
+assert.sameValue(probeStmt(), 'inside', 'reference from Statement position');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js b/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js
new file mode 100644
index 0000000000..378dbed655
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-lex-open-dflt.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Creation of new lexical environment (into `default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+features: [let]
+---*/
+
+let x = 'outside';
+var probeExpr, probeStmt;
+
+switch (probeExpr = function() { return x; }) {
+ default:
+ probeStmt = function() { return x; };
+ let x = 'inside';
+}
+
+assert.sameValue(probeExpr(), 'outside');
+assert.sameValue(probeStmt(), 'inside');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-var-none-case.js b/js/src/tests/test262/language/statements/switch/scope-var-none-case.js
new file mode 100644
index 0000000000..0b7767a7e0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-var-none-case.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Retainment of existing variable environment (`case` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeExpr, probeSelector, probeStmt;
+var probeBefore = function() { return x; };
+
+switch (eval('var x = 1;'), probeExpr = function() { return x; }, null) {
+ case eval('var x = 2;'), probeSelector = function() { return x; }, null:
+ probeStmt = function() { return x; };
+ var x = 3;
+}
+
+assert.sameValue(probeBefore(), 3, 'reference preceding statement');
+assert.sameValue(probeExpr(), 3, 'reference from first Expression');
+assert.sameValue(probeSelector(), 3, 'reference from "selector" Expression');
+assert.sameValue(probeStmt(), 3, 'reference from Statement position');
+assert.sameValue(x, 3, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js b/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js
new file mode 100644
index 0000000000..06cf1f2658
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/scope-var-none-dflt.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-switch-statement-runtime-semantics-evaluation
+description: Retainment of existing variable environment (`default` clause)
+info: |
+ 1. Let exprRef be the result of evaluating Expression.
+ 2. Let switchValue be ? GetValue(exprRef).
+ 3. Let oldEnv be the running execution context's LexicalEnvironment.
+ 4. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
+ 5. Perform BlockDeclarationInstantiation(CaseBlock, blockEnv).
+ 6. Set the running execution context's LexicalEnvironment to blockEnv.
+ 7. Let R be the result of performing CaseBlockEvaluation of CaseBlock with
+ argument switchValue.
+ [...]
+flags: [noStrict]
+---*/
+
+var probeExpr, probeStmt;
+var probeBefore = function() { return x; };
+
+switch (eval('var x = 1;'), probeExpr = function() { return x; }) {
+ default:
+ probeStmt = function() { return x; };
+ var x = 2;
+}
+
+assert.sameValue(probeBefore(), 2, 'reference preceding statment');
+assert.sameValue(probeExpr(), 2, 'reference from Expression position');
+assert.sameValue(probeStmt(), 2, 'reference from Statement position');
+assert.sameValue(x, 2, 'reference following statement');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/shell.js b/js/src/tests/test262/language/statements/switch/shell.js
new file mode 100644
index 0000000000..43295587f4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/shell.js
@@ -0,0 +1,16 @@
+// GENERATED, DO NOT EDIT
+// file: tcoHelper.js
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ This defines the number of consecutive recursive function calls that must be
+ made in order to prove that stack frames are properly destroyed according to
+ ES2015 tail call optimization semantics.
+defines: [$MAX_ITERATIONS]
+---*/
+
+
+
+
+var $MAX_ITERATIONS = 100000;
diff --git a/js/src/tests/test262/language/statements/switch/syntax/browser.js b/js/src/tests/test262/language/statements/switch/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..3ee12c3def
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..60eec83b9c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..4728da3f76
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2289b841bb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..b52c942573
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..def04c2f1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..0999405b9d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..4ec45cf633
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-async-function-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (AsyncFunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..828b885263
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..1cac5dc1fc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..6c8c86a5cb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2056071877
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..8b953d7f2a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..b04bf4d0fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..4608ab9a43
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..a0c1869be9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-async-generator-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (AsyncGeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: async function* f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/browser.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..fad2f88bb5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..8d341655db
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..4ad5a0ea36
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..c1c93ffde9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..8c1574c04e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..dd1ec79966
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..ff7ebcca51
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..bfb72715b4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-class-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (ClassDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: class f {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..ff5c0091a1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..8913273ff4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..2cd4a1d34d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..72fa1dbd58
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..f23baad402
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..d577f27d4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..5bac48e93a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..e3645885ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-const-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (LexicalDeclaration (const) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: const f = 0; default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..cae926f3d2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..28d3c1e581
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..1095081ff9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..8250fb9ff8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js
new file mode 100644
index 0000000000..0a56688b39
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..3914f675af
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..154045a3d5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..6b158a101e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-function-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (FunctionDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..04fbfaad85
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..a5ecdae257
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration, generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..468c37536a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..9cbbb3f6e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..084bf41aa9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..275b18e9b2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..8c4bf0e039
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..4d6112bbf3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-generator-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (GeneratorDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: function* f() {} default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..b5ff40d149
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..bf790d7c96
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..d2ceea9121
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..2a54582b3e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..43e7f084e1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..67ae4d146a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..1f83668e8e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if the LexicallyDeclaredNames of CaseBlock contains any
+ duplicate entries.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..952bf84ee0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-let-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (LexicalDeclaration (let) in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: let f; default: var f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/shell.js
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js
new file mode 100644
index 0000000000..b7e4561feb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-function.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: async function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js
new file mode 100644
index 0000000000..0671fe46ff
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/async-generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: async function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js
new file mode 100644
index 0000000000..8b073c8ed9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/class.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with ClassDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: class f {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js
new file mode 100644
index 0000000000..d0b77f0ca8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/const.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with const-LexicalDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: const f = 0 }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js
new file mode 100644
index 0000000000..ea3a499441
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/function.case
+// - src/declarations/redeclare-allow-sloppy-function/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with FunctionDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: function f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js
new file mode 100644
index 0000000000..3d7a9df12d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/generator.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with GeneratorDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+features: [generators]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: function* f() {} }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js
new file mode 100644
index 0000000000..0eaf5ec31e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js
@@ -0,0 +1,23 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/declarations/let.case
+// - src/declarations/redeclare/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with let-LexicalDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+switch (0) { case 1: var f; default: let f }
diff --git a/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js
new file mode 100644
index 0000000000..fbfd7f52c0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js
@@ -0,0 +1,18 @@
+// This file was procedurally generated from the following sources:
+// - src/declarations/var.case
+// - src/declarations/redeclare-allow-var/switch-attempt-to-redeclare-var-declaration.template
+/*---
+description: redeclaration with VariableDeclaration (VariableDeclaration in SwitchStatement)
+esid: sec-switch-statement-static-semantics-early-errors
+flags: [generated]
+info: |
+ SwitchStatement : switch ( Expression ) CaseBlock
+
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ CaseBlock also occurs in the VarDeclaredNames of CaseBlock.
+---*/
+
+
+switch (0) { case 1: var f; default: var f }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/syntax/shell.js b/js/src/tests/test262/language/statements/switch/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/syntax/shell.js
diff --git a/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js b/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js
new file mode 100644
index 0000000000..82f955351c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-case-body-dflt-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { case 0: return f(n - 1); default: }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js b/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js
new file mode 100644
index 0000000000..f13097eae3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-case-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { case 0: return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js b/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js
new file mode 100644
index 0000000000..1988f98e4b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/switch/tco-dftl-body-strict.js
@@ -0,0 +1,23 @@
+// |reftest| skip -- tail-call-optimization is not supported
+'use strict';
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement within statement is a candidate for tail-call optimization.
+esid: sec-static-semantics-hascallintailposition
+flags: [onlyStrict]
+features: [tail-call-optimization]
+includes: [tcoHelper.js]
+---*/
+
+var callCount = 0;
+(function f(n) {
+ if (n === 0) {
+ callCount += 1
+ return;
+ }
+ switch(0) { default: return f(n - 1); }
+}($MAX_ITERATIONS));
+assert.sameValue(callCount, 1);
+
+reportCompare(0, 0);