blob: d1a44c5939d8f1d50c79e68298f69f98f25edd0d [file] [log] [blame]
This test checks that the following expressions or statements are valid ECMASCRIPT code or should throw parse error
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Unary operators and member access
PASS Valid: ""
PASS Valid: "function f() { }"
PASS Invalid: "(a". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { (a }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end a compound expression."
PASS Invalid: "a[5". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a[5 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ']' to end a subscript expression."
PASS Invalid: "a[5 + 6". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a[5 + 6 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ']' to end a subscript expression."
PASS Invalid: "a.". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a. }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a property name after '.'."
PASS Invalid: "()". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { () }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "a.'l'". Produced the following syntax error: "SyntaxError: Unexpected string literal 'l'. Expected a property name after '.'."
PASS Invalid: "function f() { a.'l' }". Produced the following syntax error: "SyntaxError: Unexpected string literal 'l'. Expected a property name after '.'."
PASS Valid: "a: +~!new a" with ReferenceError
PASS Valid: "function f() { a: +~!new a }"
PASS Invalid: "new -a". Produced the following syntax error: "SyntaxError: Unexpected token '-'"
PASS Invalid: "function f() { new -a }". Produced the following syntax error: "SyntaxError: Unexpected token '-'"
PASS Valid: "new (-1)" with TypeError
PASS Valid: "function f() { new (-1) }"
PASS Invalid: "a: b: c: new f(x++)++". Produced the following syntax error: "SyntaxError: Postfix ++ operator applied to value that is not a reference."
PASS Invalid: "function f() { a: b: c: new f(x++)++ }". Produced the following syntax error: "SyntaxError: Postfix ++ operator applied to value that is not a reference."
PASS Valid: "(a)++" with ReferenceError
PASS Valid: "function f() { (a)++ }"
PASS Invalid: "(1--).x". Produced the following syntax error: "SyntaxError: Postfix -- operator applied to value that is not a reference."
PASS Invalid: "function f() { (1--).x }". Produced the following syntax error: "SyntaxError: Postfix -- operator applied to value that is not a reference."
PASS Invalid: "a-- ++". Produced the following syntax error: "SyntaxError: Unexpected token '++'"
PASS Invalid: "function f() { a-- ++ }". Produced the following syntax error: "SyntaxError: Unexpected token '++'"
PASS Invalid: "(a:) --b". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected ')' to end a compound expression."
PASS Invalid: "function f() { (a:) --b }". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected ')' to end a compound expression."
PASS Invalid: "++ -- ++ a". Produced the following syntax error: "SyntaxError: The prefix-increment operator requires a reference expression."
PASS Invalid: "function f() { ++ -- ++ a }". Produced the following syntax error: "SyntaxError: The prefix-increment operator requires a reference expression."
PASS Invalid: "++ new new a ++". Produced the following syntax error: "SyntaxError: Prefix ++ operator applied to value that is not a reference."
PASS Invalid: "function f() { ++ new new a ++ }". Produced the following syntax error: "SyntaxError: Prefix ++ operator applied to value that is not a reference."
PASS Valid: "delete void 0"
PASS Valid: "function f() { delete void 0 }"
PASS Invalid: "delete the void". Produced the following syntax error: "SyntaxError: Unexpected keyword 'void'. Parse error."
PASS Invalid: "function f() { delete the void }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'void'. Parse error."
PASS Invalid: "(a++". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { (a++ }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end a compound expression."
PASS Invalid: "++a--". Produced the following syntax error: "SyntaxError: The increment operator requires a reference expression."
PASS Invalid: "function f() { ++a-- }". Produced the following syntax error: "SyntaxError: The increment operator requires a reference expression."
PASS Invalid: "++((a))--". Produced the following syntax error: "SyntaxError: The increment operator requires a reference expression."
PASS Invalid: "function f() { ++((a))-- }". Produced the following syntax error: "SyntaxError: The increment operator requires a reference expression."
PASS Invalid: "(a.x++)++". Produced the following syntax error: "SyntaxError: Postfix ++ operator applied to value that is not a reference."
PASS Invalid: "function f() { (a.x++)++ }". Produced the following syntax error: "SyntaxError: Postfix ++ operator applied to value that is not a reference."
PASS Invalid: "1: null". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Parse error."
PASS Invalid: "function f() { 1: null }". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Parse error."
PASS Invalid: "+-!~". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { +-!~ }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "+-!~((". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { +-!~(( }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "a)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { a) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "a]". Produced the following syntax error: "SyntaxError: Unexpected token ']'"
PASS Invalid: "function f() { a] }". Produced the following syntax error: "SyntaxError: Unexpected token ']'"
PASS Invalid: ".l". Produced the following syntax error: "SyntaxError: Unexpected token '.'"
PASS Invalid: "function f() { .l }". Produced the following syntax error: "SyntaxError: Unexpected token '.'"
PASS Invalid: "1.l". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "function f() { 1.l }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Valid: "1 .l"
PASS Valid: "function f() { 1 .l }"
Octal numbers
PASS Valid: "'use strict'; 0"
PASS Valid: "function f() { 'use strict'; 0 }"
PASS Valid: "0"
PASS Valid: "function f() { 0 }"
PASS Invalid: "'use strict'; 00". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Invalid: "function f() { 'use strict'; 00 }". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Valid: "00"
PASS Valid: "function f() { 00 }"
PASS Invalid: "'use strict'; 08". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Invalid: "function f() { 'use strict'; 08 }". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Valid: "08"
PASS Valid: "function f() { 08 }"
PASS Invalid: "'use strict'; 09". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Invalid: "function f() { 'use strict'; 09 }". Produced the following syntax error: "SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode"
PASS Valid: "09"
PASS Valid: "function f() { 09 }"
Binary and conditional operators
PASS Valid: "a + + typeof this" with ReferenceError
PASS Valid: "function f() { a + + typeof this }"
PASS Invalid: "a + * b". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Invalid: "function f() { a + * b }". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Invalid: "a ? b". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a ? b }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ':' in ternary operator."
PASS Invalid: "a ? b :". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a ? b : }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "%a". Produced the following syntax error: "SyntaxError: Unexpected token '%'"
PASS Invalid: "function f() { %a }". Produced the following syntax error: "SyntaxError: Unexpected token '%'"
PASS Invalid: "a-". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a- }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Valid: "a = b ? b = c : d = e" with ReferenceError
PASS Valid: "function f() { a = b ? b = c : d = e }"
PASS Valid: "s: a[1].l ? b.l['s'] ? c++ : d : true" with ReferenceError
PASS Valid: "function f() { s: a[1].l ? b.l['s'] ? c++ : d : true }"
PASS Valid: "a ? b + 1 ? c + 3 * d.l : d[5][6] : e" with ReferenceError
PASS Valid: "function f() { a ? b + 1 ? c + 3 * d.l : d[5][6] : e }"
PASS Valid: "a in b instanceof delete -c" with ReferenceError
PASS Valid: "function f() { a in b instanceof delete -c }"
PASS Invalid: "a in instanceof b.l". Produced the following syntax error: "SyntaxError: Unexpected keyword 'instanceof'"
PASS Invalid: "function f() { a in instanceof b.l }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'instanceof'"
PASS Valid: "- - true % 5"
PASS Valid: "function f() { - - true % 5 }"
PASS Invalid: "- false = 3". Produced the following syntax error: "SyntaxError: Left hand side of operator '=' must be a reference."
PASS Invalid: "function f() { - false = 3 }". Produced the following syntax error: "SyntaxError: Left hand side of operator '=' must be a reference."
PASS Invalid: "a: b: c: (1 + null) = 3". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { a: b: c: (1 + null) = 3 }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Valid: "a[2] = b.l += c /= 4 * 7 ^ !6" with ReferenceError
PASS Valid: "function f() { a[2] = b.l += c /= 4 * 7 ^ !6 }"
PASS Invalid: "a + typeof b += c in d". Produced the following syntax error: "SyntaxError: Left hand side of operator '+=' must be a reference."
PASS Invalid: "function f() { a + typeof b += c in d }". Produced the following syntax error: "SyntaxError: Left hand side of operator '+=' must be a reference."
PASS Invalid: "typeof a &= typeof b". Produced the following syntax error: "SyntaxError: Left hand side of operator '&=' must be a reference."
PASS Invalid: "function f() { typeof a &= typeof b }". Produced the following syntax error: "SyntaxError: Left hand side of operator '&=' must be a reference."
PASS Invalid: "a: ((typeof (a))) >>>= a || b.l && c". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { a: ((typeof (a))) >>>= a || b.l && c }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Valid: "a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g" with ReferenceError
PASS Valid: "function f() { a: b: c[a /= f[a %= b]].l[c[x] = 7] -= a ? b <<= f : g }"
PASS Valid: "-void+x['y'].l == x.l != 5 - f[7]" with ReferenceError
PASS Valid: "function f() { -void+x['y'].l == x.l != 5 - f[7] }"
Function calls (and new with arguments)
PASS Valid: "a()()()" with ReferenceError
PASS Valid: "function f() { a()()() }"
PASS Invalid: "s: l: a[2](4 == 6, 5 = 6)(f[4], 6)". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { s: l: a[2](4 == 6, 5 = 6)(f[4], 6) }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Valid: "s: eval(a.apply(), b.call(c[5] - f[7]))" with ReferenceError
PASS Valid: "function f() { s: eval(a.apply(), b.call(c[5] - f[7])) }"
PASS Invalid: "a(". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a( }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "a(5". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a(5 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end an argument list."
PASS Invalid: "a(5,". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a(5, }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Valid: "a(5,)" with ReferenceError
PASS Valid: "function f() { a(5,) }"
PASS Invalid: "a(5,6". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { a(5,6 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end an argument list."
PASS Valid: "a(b[7], c <d> e.l, new a() > b)" with ReferenceError
PASS Valid: "function f() { a(b[7], c <d> e.l, new a() > b) }"
PASS Invalid: "a(b[5)". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected ']' to end a subscript expression."
PASS Invalid: "function f() { a(b[5) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected ']' to end a subscript expression."
PASS Invalid: "a(b.)". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected a property name after '.'."
PASS Invalid: "function f() { a(b.) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected a property name after '.'."
PASS Valid: "~new new a(1)(i++)(c[l])" with ReferenceError
PASS Valid: "function f() { ~new new a(1)(i++)(c[l]) }"
PASS Invalid: "a(*a)". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Invalid: "function f() { a(*a) }". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Valid: "((((a))((b)()).l))()" with ReferenceError
PASS Valid: "function f() { ((((a))((b)()).l))() }"
PASS Valid: "(a)[b + (c) / (d())].l--" with ReferenceError
PASS Valid: "function f() { (a)[b + (c) / (d())].l-- }"
PASS Valid: "new (5)" with TypeError
PASS Valid: "function f() { new (5) }"
PASS Invalid: "new a(5". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { new a(5 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end an argument list."
PASS Valid: "new (f + 5)(6, (g)() - 'l'() - true(false))" with ReferenceError
PASS Valid: "function f() { new (f + 5)(6, (g)() - 'l'() - true(false)) }"
PASS Invalid: "a(.length)". Produced the following syntax error: "SyntaxError: Unexpected token '.'"
PASS Invalid: "function f() { a(.length) }". Produced the following syntax error: "SyntaxError: Unexpected token '.'"
function declaration and expression
PASS Valid: "function f() {}"
PASS Valid: "function f() { function f() {} }"
PASS Valid: "function f(a,b) {}"
PASS Valid: "function f() { function f(a,b) {} }"
PASS Invalid: "function () {}". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Invalid: "function f() { function () {} }". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Invalid: "function f(a b) {}". Produced the following syntax error: "SyntaxError: Unexpected identifier 'b'. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function f() { function f(a b) {} }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'b'. Expected a ')' or a ',' after a parameter declaration."
PASS Valid: "function f(a,) {}"
PASS Valid: "function f() { function f(a,) {} }"
PASS Invalid: "function f(a,". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { function f(a, }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f(a, 1) {}". Produced the following syntax error: "SyntaxError: Unexpected number '1'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { function f(a, 1) {} }". Produced the following syntax error: "SyntaxError: Unexpected number '1'. Expected a parameter pattern or a ')' in parameter list."
PASS Valid: "function g(arguments, eval) {}"
PASS Valid: "function f() { function g(arguments, eval) {} }"
PASS Valid: "function f() {} + function g() {}"
PASS Valid: "function f() { function f() {} + function g() {} }"
PASS Invalid: "(function a{})". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected an opening '(' before a function's parameter list."
PASS Invalid: "function f() { (function a{}) }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected an opening '(' before a function's parameter list."
PASS Invalid: "(function this(){})". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'this' as a function name."
PASS Invalid: "function f() { (function this(){}) }". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'this' as a function name."
PASS Valid: "(delete new function f(){} + function(a,b){}(5)(6))" with TypeError
PASS Valid: "function f() { (delete new function f(){} + function(a,b){}(5)(6)) }"
PASS Valid: "6 - function (m) { function g() {} }"
PASS Valid: "function f() { 6 - function (m) { function g() {} } }"
PASS Invalid: "function l() {". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { function l() { }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function l++(){}". Produced the following syntax error: "SyntaxError: Unexpected token '++'. Expected an opening '(' before a function's parameter list."
PASS Invalid: "function f() { function l++(){} }". Produced the following syntax error: "SyntaxError: Unexpected token '++'. Expected an opening '(' before a function's parameter list."
Array and object literal, comma operator
PASS Valid: "[] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,]" with TypeError
PASS Valid: "function f() { [] in [5,6] * [,5,] / [,,5,,] || [a,] && new [,b] % [,,] }"
PASS Invalid: "[5,". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { [5, }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "[,". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { [, }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "(a,)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { (a,) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Valid: "1 + {get get(){}, set set(a){}, get1:4, set1:get-set, }" with ReferenceError
PASS Valid: "function f() { 1 + {get get(){}, set set(a){}, get1:4, set1:get-set, } }"
PASS Invalid: "1 + {a". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 + {a }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "1 + {a:". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 + {a: }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 + {get l(". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 + {get l( }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. getter functions must have no parameters."
PASS Invalid: ",a". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Invalid: "function f() { ,a }". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Valid: "(4,(5,a(3,4))),f[4,a-6]" with ReferenceError
PASS Valid: "function f() { (4,(5,a(3,4))),f[4,a-6] }"
PASS Invalid: "(,f)". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Invalid: "function f() { (,f) }". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Invalid: "a,,b". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Invalid: "function f() { a,,b }". Produced the following syntax error: "SyntaxError: Unexpected token ','"
PASS Invalid: "a ? b, c : d". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected ':' in ternary operator."
PASS Invalid: "function f() { a ? b, c : d }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected ':' in ternary operator."
simple statements
PASS Valid: "{ }"
PASS Valid: "function f() { { } }"
PASS Invalid: "{ { }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { { { } }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Valid: "{ ; ; ; }"
PASS Valid: "function f() { { ; ; ; } }"
PASS Valid: "a: { ; }"
PASS Valid: "function f() { a: { ; } }"
PASS Invalid: "{ a: }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Cannot parse statement."
PASS Invalid: "function f() { { a: } }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Cannot parse statement."
PASS Valid: "{} f; { 6 + f() }" with ReferenceError
PASS Valid: "function f() { {} f; { 6 + f() } }"
PASS Valid: "{ a[5],6; {} ++b-new (-5)() } c().l++" with ReferenceError
PASS Valid: "function f() { { a[5],6; {} ++b-new (-5)() } c().l++ }"
PASS Valid: "{ l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } }" with ReferenceError
PASS Valid: "function f() { { l1: l2: l3: { this } a = 32 ; { i++ ; { { { } } ++i } } } }"
PASS Valid: "if (a) ;"
PASS Valid: "function f() { if (a) ; }"
PASS Invalid: "{ if (a) }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a statement as the body of an if block."
PASS Invalid: "function f() { { if (a) } }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a statement as the body of an if block."
PASS Invalid: "if a {}". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start an 'if' condition."
PASS Invalid: "function f() { if a {} }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start an 'if' condition."
PASS Invalid: "if (a". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { if (a }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end an 'if' condition."
PASS Invalid: "if (a { }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ')' to end an 'if' condition."
PASS Invalid: "function f() { if (a { } }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ')' to end an 'if' condition."
PASS Valid: "x: s: if (a) ; else b"
PASS Valid: "function f() { x: s: if (a) ; else b }"
PASS Invalid: "else {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "function f() { else {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Valid: "if (a) if (b) y; else {} else ;" with ReferenceError
PASS Valid: "function f() { if (a) if (b) y; else {} else ; }"
PASS Invalid: "if (a) {} else x; else". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "function f() { if (a) {} else x; else }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "if (a) { else }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "function f() { if (a) { else } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Valid: "if (a.l + new b()) 4 + 5 - f()" with ReferenceError
PASS Valid: "function f() { if (a.l + new b()) 4 + 5 - f() }"
PASS Valid: "if (a) with (x) ; else with (y) ;" with ReferenceError
PASS Valid: "function f() { if (a) with (x) ; else with (y) ; }"
PASS Invalid: "with a.b { }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a subject of a 'with' statement."
PASS Invalid: "function f() { with a.b { } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a subject of a 'with' statement."
PASS Valid: "while (a() - new b) ;" with TypeError
PASS Valid: "function f() { while (a() - new b) ; }"
PASS Invalid: "while a {}". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a while loop condition."
PASS Invalid: "function f() { while a {} }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a while loop condition."
PASS Valid: "do ; while(0) i++" with ReferenceError
PASS Valid: "function f() { do ; while(0) i++ }"
PASS Valid: "do if (a) x; else y; while(z)" with ReferenceError
PASS Valid: "function f() { do if (a) x; else y; while(z) }"
PASS Invalid: "do g; while 4". Produced the following syntax error: "SyntaxError: Unexpected number '4'. Expected '(' to start a do-while loop condition."
PASS Invalid: "function f() { do g; while 4 }". Produced the following syntax error: "SyntaxError: Unexpected number '4'. Expected '(' to start a do-while loop condition."
PASS Invalid: "do g; while ((4)". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { do g; while ((4) }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end a do-while loop condition."
PASS Valid: "{ { do do do ; while(0) while(0) while(0) } }"
PASS Valid: "function f() { { { do do do ; while(0) while(0) while(0) } } }"
PASS Valid: "do while (0) if (a) {} else y; while(0)"
PASS Valid: "function f() { do while (0) if (a) {} else y; while(0) }"
PASS Valid: "if (a) while (b) if (c) with(d) {} else e; else f" with ReferenceError
PASS Valid: "function f() { if (a) while (b) if (c) with(d) {} else e; else f }"
PASS Invalid: "break ; break your_limits ; continue ; continue living ; debugger". Produced the following syntax error: "SyntaxError: 'break' is only valid inside a switch or loop statement."
PASS Invalid: "function f() { break ; break your_limits ; continue ; continue living ; debugger }". Produced the following syntax error: "SyntaxError: 'break' is only valid inside a switch or loop statement."
PASS Invalid: "debugger X". Produced the following syntax error: "SyntaxError: Unexpected identifier 'X'. Debugger keyword must be followed by a ';'."
PASS Invalid: "function f() { debugger X }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'X'. Debugger keyword must be followed by a ';'."
PASS Invalid: "break 0.2". Produced the following syntax error: "SyntaxError: Unexpected number '0.2'. Expected an identifier as the target for a break statement."
PASS Invalid: "function f() { break 0.2 }". Produced the following syntax error: "SyntaxError: Unexpected number '0.2'. Expected an identifier as the target for a break statement."
PASS Invalid: "continue a++". Produced the following syntax error: "SyntaxError: Cannot use the undeclared label 'a'."
PASS Invalid: "function f() { continue a++ }". Produced the following syntax error: "SyntaxError: Cannot use the undeclared label 'a'."
PASS Invalid: "continue (my_friend)". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected an identifier as the target for a continue statement."
PASS Invalid: "function f() { continue (my_friend) }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected an identifier as the target for a continue statement."
PASS Valid: "while (1) break"
PASS Valid: "function f() { while (1) break }"
PASS Valid: "do if (a) with (b) continue; else debugger; while (false)" with ReferenceError
PASS Valid: "function f() { do if (a) with (b) continue; else debugger; while (false) }"
PASS Invalid: "do if (a) while (false) else debugger". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "function f() { do if (a) while (false) else debugger }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "while if (a) ;". Produced the following syntax error: "SyntaxError: Unexpected keyword 'if'. Expected '(' to start a while loop condition."
PASS Invalid: "function f() { while if (a) ; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'if'. Expected '(' to start a while loop condition."
PASS Valid: "if (a) function f() {} else function g() {}"
PASS Valid: "function f() { if (a) function f() {} else function g() {} }"
PASS Invalid: "if (a()) while(0) function f() {} else function g() {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { if (a()) while(0) function f() {} else function g() {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "if (a()) function f() { else function g() }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "function f() { if (a()) function f() { else function g() } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'"
PASS Invalid: "if (a) if (b) ; else function f {}". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected an opening '(' before a function's parameter list."
PASS Invalid: "function f() { if (a) if (b) ; else function f {} }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected an opening '(' before a function's parameter list."
PASS Invalid: "if (a) if (b) ; else function (){}". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Invalid: "function f() { if (a) if (b) ; else function (){} }". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Valid: "throw a" with 32
PASS Valid: "function f() { throw a }"
PASS Valid: "throw a + b in void c" with ReferenceError
PASS Valid: "function f() { throw a + b in void c }"
PASS Invalid: "throw". Produced the following syntax error: "SyntaxError: Cannot have a newline after 'throw'."
PASS Invalid: "function f() { throw }". Produced the following syntax error: "SyntaxError: Cannot have a newline after 'throw'."
var and const statements
PASS Valid: "var a, b = null"
PASS Valid: "function f() { var a, b = null }"
PASS Valid: "const a = 5, b = 10, c = 20"
PASS Valid: "function f() { const a = 5, b = 10, c = 20 }"
PASS Invalid: "var". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "var = 7". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { var = 7 }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "var c (6)". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected ';' after variable declaration."
PASS Invalid: "function f() { var c (6) }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected ';' after variable declaration."
PASS Valid: "if (a) var a,b; else { const b = 1, c = 2; }"
PASS Valid: "function f() { if (a) var a,b; else { const b = 1, c = 2; } }"
PASS Invalid: "if (a) var a,b; else { const b, c }". Produced the following syntax error: "SyntaxError: Unexpected token ','. const declared variable 'b' must have an initializer."
PASS Invalid: "function f() { if (a) var a,b; else { const b, c } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. const declared variable 'b' must have an initializer."
PASS Invalid: "var 5 = 6". Produced the following syntax error: "SyntaxError: Unexpected number '5'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { var 5 = 6 }". Produced the following syntax error: "SyntaxError: Unexpected number '5'. Expected a parameter pattern or a ')' in parameter list."
PASS Valid: "while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h"
PASS Valid: "function f() { while (0) var a, b, c=6, d, e, f=5*6, g=f*h, h }"
PASS Invalid: "var a = if (b) { c }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'if'"
PASS Invalid: "function f() { var a = if (b) { c } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'if'"
PASS Invalid: "var a = var b". Produced the following syntax error: "SyntaxError: Unexpected keyword 'var'"
PASS Invalid: "function f() { var a = var b }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'var'"
PASS Invalid: "const a = b += c, a, a, a = (b - f())". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'a'."
PASS Invalid: "function f() { const a = b += c, a, a, a = (b - f()) }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'a'."
PASS Invalid: "var a %= b | 5". Produced the following syntax error: "SyntaxError: Unexpected token '%='. Expected ';' after variable declaration."
PASS Invalid: "function f() { var a %= b | 5 }". Produced the following syntax error: "SyntaxError: Unexpected token '%='. Expected ';' after variable declaration."
PASS Invalid: "var (a) = 5". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { var (a) = 5 }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "var a = (4, b = 6". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var a = (4, b = 6 }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected ')' to end a compound expression."
PASS Invalid: "const 'l' = 3". Produced the following syntax error: "SyntaxError: Unexpected string literal 'l'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { const 'l' = 3 }". Produced the following syntax error: "SyntaxError: Unexpected string literal 'l'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "var var = 3". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'var' as a variable name."
PASS Invalid: "function f() { var var = 3 }". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'var' as a variable name."
PASS Valid: "var varr = 3 in 1" with TypeError
PASS Valid: "function f() { var varr = 3 in 1 }"
PASS Valid: "const a = void 7 - typeof 8, b = 8"
PASS Valid: "function f() { const a = void 7 - typeof 8, b = 8 }"
PASS Invalid: "const a, a, a = void 7 - typeof 8, a = 8". Produced the following syntax error: "SyntaxError: Unexpected token ','. const declared variable 'a' must have an initializer."
PASS Invalid: "function f() { const a, a, a = void 7 - typeof 8, a = 8 }". Produced the following syntax error: "SyntaxError: Unexpected token ','. const declared variable 'a' must have an initializer."
PASS Invalid: "const x_x = 6 /= 7 ? e : f". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { const x_x = 6 /= 7 ? e : f }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "var a = ?". Produced the following syntax error: "SyntaxError: Unexpected token '?'"
PASS Invalid: "function f() { var a = ? }". Produced the following syntax error: "SyntaxError: Unexpected token '?'"
PASS Invalid: "const a = *7". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Invalid: "function f() { const a = *7 }". Produced the following syntax error: "SyntaxError: Unexpected token '*'"
PASS Invalid: "var a = :)". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Invalid: "function f() { var a = :) }". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Valid: "var a = a in b in c instanceof d" with ReferenceError
PASS Valid: "function f() { var a = a in b in c instanceof d }"
PASS Invalid: "var a = b ? c, b". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected ':' in ternary operator."
PASS Invalid: "function f() { var a = b ? c, b }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected ':' in ternary operator."
PASS Invalid: "const a = b : c". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected ';' after variable declaration."
PASS Invalid: "function f() { const a = b : c }". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected ';' after variable declaration."
PASS Valid: "const a = 7; eval(''); a++" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a++ }"
PASS Valid: "const a = 7; eval(''); a--" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a-- }"
PASS Valid: "const a = 7; with({}) a++" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a++ }"
PASS Valid: "const a = 7; with({}) a--" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a-- }"
PASS Valid: "const a = 7; eval(''); a+=1" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a+=1 }"
PASS Valid: "const a = 7; eval(''); a-=1" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a-=1 }"
PASS Valid: "const a = 7; with({}) a+=1" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a+=1 }"
PASS Valid: "const a = 7; with({}) a-=1" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a-=1 }"
PASS Valid: "const a = 7; eval(''); a=1" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a=1 }"
PASS Valid: "const a = 7; eval(''); a=1" with TypeError
PASS Valid: "function f() { const a = 7; eval(''); a=1 }"
PASS Valid: "const a = 7; with({}) a=1" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a=1 }"
PASS Valid: "const a = 7; with({}) a=1" with TypeError
PASS Valid: "function f() { const a = 7; with({}) a=1 }"
for statement
PASS Valid: "for ( ; ; ) { break }"
PASS Valid: "function f() { for ( ; ; ) { break } }"
PASS Valid: "for ( a ; ; ) { break }"
PASS Valid: "function f() { for ( a ; ; ) { break } }"
PASS Valid: "for ( ; a ; ) { break }"
PASS Valid: "function f() { for ( ; a ; ) { break } }"
PASS Valid: "for ( ; ; a ) { break }"
PASS Valid: "function f() { for ( ; ; a ) { break } }"
PASS Valid: "for ( a ; a ; ) break"
PASS Valid: "function f() { for ( a ; a ; ) break }"
PASS Valid: "for ( a ; ; a ) break"
PASS Valid: "function f() { for ( a ; ; a ) break }"
PASS Valid: "for ( ; a ; a ) break"
PASS Valid: "function f() { for ( ; a ; a ) break }"
PASS Invalid: "for () { }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for () { } }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for ( a ) { }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for ( a ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "for ( ; ) ;". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for ( ; ) ; }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for a ; b ; c { }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a for-loop header."
PASS Invalid: "function f() { for a ; b ; c { } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected '(' to start a for-loop header."
PASS Invalid: "for (a ; { }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { for (a ; { } }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected a ';' after the for loop condition expression."
PASS Invalid: "for ( a ; ) ;". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for ( a ; ) ; }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for ( ; a ) break". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected a ';' after the for loop condition expression."
PASS Invalid: "function f() { for ( ; a ) break }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. Expected a ';' after the for loop condition expression."
PASS Valid: "for (var a, b ; ; ) { break } "
PASS Valid: "function f() { for (var a, b ; ; ) { break } }"
PASS Valid: "for (var a = b, b = a ; ; ) break"
PASS Valid: "function f() { for (var a = b, b = a ; ; ) break }"
PASS Valid: "for (var a = b, c, d, b = a ; x in b ; ) { break }" with ReferenceError
PASS Valid: "function f() { for (var a = b, c, d, b = a ; x in b ; ) { break } }"
PASS Valid: "for (var a = b, c, d ; ; 1 in a()) break" with ReferenceError
PASS Valid: "function f() { for (var a = b, c, d ; ; 1 in a()) break }"
PASS Invalid: "for ( ; var a ; ) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'var'"
PASS Invalid: "function f() { for ( ; var a ; ) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'var'"
PASS Invalid: "for (const x; ; ) break". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const variables in for loops must have initializers."
PASS Invalid: "function f() { for (const x; ; ) break }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const variables in for loops must have initializers."
PASS Invalid: "for (const x = 20, y; ; ) break". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const variables in for loops must have initializers."
PASS Invalid: "function f() { for (const x = 20, y; ; ) break }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const variables in for loops must have initializers."
PASS Valid: "for (const x = 20; ; ) break"
PASS Valid: "function f() { for (const x = 20; ; ) break }"
PASS Valid: "for (const x of []) break"
PASS Valid: "function f() { for (const x of []) break }"
PASS Valid: "for (const x in {}) break"
PASS Valid: "function f() { for (const x in {}) break }"
PASS Invalid: "for (const x = 20, x = 30; ; ) { const x = 20; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'x'."
PASS Invalid: "function f() { for (const x = 20, x = 30; ; ) { const x = 20; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'x'."
PASS Valid: "for (const x = 20; ; ) { const x = 20; break; }"
PASS Valid: "function f() { for (const x = 20; ; ) { const x = 20; break; } }"
PASS Valid: "for (const x of []) { const x = 20; break; }"
PASS Valid: "function f() { for (const x of []) { const x = 20; break; } }"
PASS Valid: "for (const x in {}) { const x = 20; break; }"
PASS Valid: "function f() { for (const x in {}) { const x = 20; break; } }"
PASS Invalid: "for (const let = 10; ; ) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (const let = 10; ; ) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for (const let in {}) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (const let in {}) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for (const let of []) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (const let of []) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for (let let = 10; ; ) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (let let = 10; ; ) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for (let let in {}) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (let let in {}) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for (let let of []) { break; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { for (let let of []) { break; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "for ( %a ; ; ) { }". Produced the following syntax error: "SyntaxError: Unexpected token '%'"
PASS Invalid: "function f() { for ( %a ; ; ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '%'"
PASS Valid: "for (a in b) break" with ReferenceError
PASS Valid: "function f() { for (a in b) break }"
PASS Valid: "for (a() in b) break" with ReferenceError
PASS Valid: "function f() { for (a() in b) break }"
PASS Valid: "for (a().l[4] in b) break" with ReferenceError
PASS Valid: "function f() { for (a().l[4] in b) break }"
PASS Valid: "for (new a in b in c in d) break" with ReferenceError
PASS Valid: "function f() { for (new a in b in c in d) break }"
PASS Valid: "for (new new new a in b) break" with ReferenceError
PASS Valid: "function f() { for (new new new a in b) break }"
PASS Invalid: "for (delete new a() in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (delete new a() in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "for (a * a in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (a * a in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Valid: "for ((a * a) in b) break" with ReferenceError
PASS Valid: "function f() { for ((a * a) in b) break }"
PASS Invalid: "for (a++ in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (a++ in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Valid: "for ((a++) in b) break" with ReferenceError
PASS Valid: "function f() { for ((a++) in b) break }"
PASS Invalid: "for (++a in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (++a in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Valid: "for ((++a) in b) break" with ReferenceError
PASS Valid: "function f() { for ((++a) in b) break }"
PASS Invalid: "for (a, b in c) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (a, b in c) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "for (a,b in c ;;) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (a,b in c ;;) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Valid: "for (a,(b in c) ;;) break" with ReferenceError
PASS Valid: "function f() { for (a,(b in c) ;;) break }"
PASS Valid: "for ((a, b) in c) break" with ReferenceError
PASS Valid: "function f() { for ((a, b) in c) break }"
PASS Invalid: "for (a ? b : c in c) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Invalid: "function f() { for (a ? b : c in c) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. Expected a reference on the left hand side of an enumeration statement."
PASS Valid: "for ((a ? b : c) in c) break" with ReferenceError
PASS Valid: "function f() { for ((a ? b : c) in c) break }"
PASS Valid: "for (var a in b in c) break" with ReferenceError
PASS Valid: "function f() { for (var a in b in c) break }"
PASS Invalid: "for (var a = 5 += 6 in b) break". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { for (var a = 5 += 6 in b) break }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Valid: "for (var a = foo('should be hit') in b) break" with ReferenceError
PASS Valid: "function f() { for (var a = foo('should be hit') in b) break }"
PASS Invalid: "for (var a += 5 in b) break". Produced the following syntax error: "SyntaxError: Unexpected token '+='. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var a += 5 in b) break }". Produced the following syntax error: "SyntaxError: Unexpected token '+='. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "for (var a = in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'"
PASS Invalid: "function f() { for (var a = in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'"
PASS Invalid: "for (var a, b in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Invalid: "function f() { for (var a, b in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Invalid: "for (var a = -6, b in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Invalid: "function f() { for (var a = -6, b in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Invalid: "for (var a, b = 8 in b) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Invalid: "function f() { for (var a, b = 8 in b) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'. can only declare a single variable in an enumeration."
PASS Valid: "for (var a = (b in c) in d) break" with ReferenceError
PASS Valid: "function f() { for (var a = (b in c) in d) break }"
PASS Invalid: "for (var a = (b in c in d) break". Produced the following syntax error: "SyntaxError: Unexpected keyword 'break'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var a = (b in c in d) break }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'break'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "for (var (a) in b) { }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { for (var (a) in b) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {}". Produced the following syntax error: "SyntaxError: The decrement operator requires a reference expression."
PASS Invalid: "function f() { for (var a = 7, b = c < d >= d ; f()[6]++ ; --i()[1]++ ) {} }". Produced the following syntax error: "SyntaxError: The decrement operator requires a reference expression."
PASS Invalid: "for (var {a} = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (var {a} = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "for (var {a} = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var {a} = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (var {a} = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (var {a} = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Valid: "for (var i = 20 in b) { }" with ReferenceError
PASS Valid: "function f() { for (var i = 20 in b) { } }"
PASS Invalid: "for (var i = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var i = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (var {i} = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var {i} = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (var [i] = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var [i] = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (let [i] = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (let [i] = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (const [i] = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (const [i] = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (const i = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (const i = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (let i = 20 of b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (let i = 20 of b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (let i = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (let i = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "for (const i = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (const i = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "for (const {i} = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (const {i} = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "for (let {i} = 20 in b) { }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Invalid: "function f() { for (let {i} = 20 in b) { } }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-in loop header."
PASS Valid: "function x(i) { for (let i in {}) { } }"
PASS Valid: "function f() { function x(i) { for (let i in {}) { } } }"
PASS Valid: "function x(i) { for (let i of []) { } }"
PASS Valid: "function f() { function x(i) { for (let i of []) { } } }"
PASS Valid: "function x(i) { for (let i of []) { } }"
PASS Valid: "function f() { function x(i) { for (let i of []) { } } }"
PASS Valid: "function x(i) { for (let i; false; ) { } }"
PASS Valid: "function f() { function x(i) { for (let i; false; ) { } } }"
PASS Valid: "let f = (i) => { for (let i in {}) { } }"
PASS Valid: "function f() { let f = (i) => { for (let i in {}) { } } }"
PASS Valid: "let f = (i) => { for (let i of []) { } }"
PASS Valid: "function f() { let f = (i) => { for (let i of []) { } } }"
PASS Valid: "let f = (i) => { for (let i of []) { } }"
PASS Valid: "function f() { let f = (i) => { for (let i of []) { } } }"
PASS Valid: "let f = (i) => { for (let i; false; ) { } }"
PASS Valid: "function f() { let f = (i) => { for (let i; false; ) { } } }"
PASS Valid: "function* x(i) { for (let i in {}) { } }"
PASS Valid: "function f() { function* x(i) { for (let i in {}) { } } }"
PASS Valid: "function* x(i) { for (let i of []) { } }"
PASS Valid: "function f() { function* x(i) { for (let i of []) { } } }"
PASS Valid: "function* x(i) { for (let i of []) { } }"
PASS Valid: "function f() { function* x(i) { for (let i of []) { } } }"
PASS Valid: "function* x(i) { for (let i; false; ) { } }"
PASS Valid: "function f() { function* x(i) { for (let i; false; ) { } } }"
PASS Valid: "function x(i) { for (const i in {}) { } }"
PASS Valid: "function f() { function x(i) { for (const i in {}) { } } }"
PASS Valid: "function x(i) { for (const i of []) { } }"
PASS Valid: "function f() { function x(i) { for (const i of []) { } } }"
PASS Valid: "function x(i) { for (const i of []) { } }"
PASS Valid: "function f() { function x(i) { for (const i of []) { } } }"
PASS Valid: "function x(i) { for (const i = 20; false; ) { } }"
PASS Valid: "function f() { function x(i) { for (const i = 20; false; ) { } } }"
PASS Valid: "let f = (i) => { for (const i in {}) { } }"
PASS Valid: "function f() { let f = (i) => { for (const i in {}) { } } }"
PASS Valid: "let f = (i) => { for (const i of []) { } }"
PASS Valid: "function f() { let f = (i) => { for (const i of []) { } } }"
PASS Valid: "let f = (i) => { for (const i of []) { } }"
PASS Valid: "function f() { let f = (i) => { for (const i of []) { } } }"
PASS Valid: "let f = (i) => { for (const i = 20; false; ) { } }"
PASS Valid: "function f() { let f = (i) => { for (const i = 20; false; ) { } } }"
PASS Valid: "function* x(i) { for (const i in {}) { } }"
PASS Valid: "function f() { function* x(i) { for (const i in {}) { } } }"
PASS Valid: "function* x(i) { for (const i of []) { } }"
PASS Valid: "function f() { function* x(i) { for (const i of []) { } } }"
PASS Valid: "function* x(i) { for (const i of []) { } }"
PASS Valid: "function f() { function* x(i) { for (const i of []) { } } }"
PASS Valid: "function* x(i) { for (const i = 20; false; ) { } }"
PASS Valid: "function f() { function* x(i) { for (const i = 20; false; ) { } } }"
try statement
PASS Invalid: "try { break } catch(e) {}". Produced the following syntax error: "SyntaxError: 'break' is only valid inside a switch or loop statement."
PASS Invalid: "function f() { try { break } catch(e) {} }". Produced the following syntax error: "SyntaxError: 'break' is only valid inside a switch or loop statement."
PASS Valid: "try {} finally { c++ }" with ReferenceError
PASS Valid: "function f() { try {} finally { c++ } }"
PASS Valid: "try { with (x) { } } catch(e) {} finally { if (a) ; }"
PASS Valid: "function f() { try { with (x) { } } catch(e) {} finally { if (a) ; } }"
PASS Invalid: "try {}". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { try {} }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Try statements must have at least a catch or finally block."
PASS Invalid: "catch(e) {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'catch'"
PASS Invalid: "function f() { catch(e) {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'catch'"
PASS Invalid: "finally {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'finally'"
PASS Invalid: "function f() { finally {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'finally'"
PASS Invalid: "try a; catch(e) {}". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected a block statement as body of a try statement."
PASS Invalid: "function f() { try a; catch(e) {} }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected a block statement as body of a try statement."
PASS Invalid: "try {} catch(e) a()". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected exception handler to be a block statement."
PASS Invalid: "function f() { try {} catch(e) a() }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected exception handler to be a block statement."
PASS Invalid: "try {} finally a()". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected block statement for finally body."
PASS Invalid: "function f() { try {} finally a() }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. Expected block statement for finally body."
PASS Invalid: "try {} catch(e)". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { try {} catch(e) }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected exception handler to be a block statement."
PASS Invalid: "try {} finally". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { try {} finally }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected block statement for finally body."
PASS Invalid: "try {} finally {} catch(e) {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'catch'"
PASS Invalid: "function f() { try {} finally {} catch(e) {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'catch'"
PASS Invalid: "try {} catch (...) {}". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { try {} catch (...) {} }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Valid: "try {} catch {}"
PASS Valid: "function f() { try {} catch {} }"
PASS Valid: "if (a) try {} finally {} else b;"
PASS Valid: "function f() { if (a) try {} finally {} else b; }"
PASS Valid: "if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {}" with ReferenceError
PASS Valid: "function f() { if (--a()) do with(1) try {} catch(ke) { f() ; g() } while (a in b) else {} }"
PASS Invalid: "if (a) try {} else b; catch (e) { }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'. Try statements must have at least a catch or finally block."
PASS Invalid: "function f() { if (a) try {} else b; catch (e) { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'else'. Try statements must have at least a catch or finally block."
PASS Invalid: "try { finally {}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'finally'"
PASS Invalid: "function f() { try { finally {} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'finally'"
switch statement
PASS Valid: "switch (a) {}"
PASS Valid: "function f() { switch (a) {} }"
PASS Invalid: "switch () {}". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { switch () {} }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "case 5:". Produced the following syntax error: "SyntaxError: Parser error"
PASS Invalid: "function f() { case 5: }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Expected a closing '}' after a function body."
PASS Invalid: "default:". Produced the following syntax error: "SyntaxError: Parser error"
PASS Invalid: "function f() { default: }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'default'. Expected a closing '}' after a function body."
PASS Invalid: "switch (a) b;". Produced the following syntax error: "SyntaxError: Unexpected identifier 'b'. Expected '{' to start a body of a 'switch'."
PASS Invalid: "function f() { switch (a) b; }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'b'. Expected '{' to start a body of a 'switch'."
PASS Invalid: "switch (a) case 3: b;". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Expected '{' to start a body of a 'switch'."
PASS Invalid: "function f() { switch (a) case 3: b; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Expected '{' to start a body of a 'switch'."
PASS Valid: "switch (f()) { case 5 * f(): default: case '6' - 9: ++i }" with ReferenceError
PASS Valid: "function f() { switch (f()) { case 5 * f(): default: case '6' - 9: ++i } }"
PASS Invalid: "switch (true) { default: case 6: default: }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'default'. Expected '}' to end a body of a 'switch'."
PASS Invalid: "function f() { switch (true) { default: case 6: default: } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'default'. Expected '}' to end a body of a 'switch'."
PASS Invalid: "switch (l) { f(); }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'f'. Expected '}' to end a body of a 'switch'."
PASS Invalid: "function f() { switch (l) { f(); } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'f'. Expected '}' to end a body of a 'switch'."
PASS Invalid: "switch (l) { case 1: ; a: case 5: }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Cannot parse statement."
PASS Invalid: "function f() { switch (l) { case 1: ; a: case 5: } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Cannot parse statement."
PASS Valid: "switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f }" with ReferenceError
PASS Valid: "function f() { switch (g() - h[5].l) { case 1 + 6: a: b: c: ++f } }"
PASS Invalid: "switch (g) { case 1: a: }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Cannot parse statement."
PASS Invalid: "function f() { switch (g) { case 1: a: } }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Cannot parse statement."
PASS Invalid: "switch (g) { case 1: a: default: }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'default'. Cannot parse statement."
PASS Invalid: "function f() { switch (g) { case 1: a: default: } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'default'. Cannot parse statement."
PASS Invalid: "switch g { case 1: l() }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'g'. Expected '(' to start a subject of a 'switch'."
PASS Invalid: "function f() { switch g { case 1: l() } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'g'. Expected '(' to start a subject of a 'switch'."
PASS Invalid: "switch (g) { case 1:". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { switch (g) { case 1: }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Valid: "switch (l) { case a = b ? c : d : }" with ReferenceError
PASS Valid: "function f() { switch (l) { case a = b ? c : d : } }"
PASS Valid: "switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : }" with ReferenceError
PASS Valid: "function f() { switch (sw) { case a ? b - 7[1] ? [c,,] : d = 6 : { } : } }"
PASS Invalid: "switch (l) { case b ? c : }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "function f() { switch (l) { case b ? c : } }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Valid: "switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: }" with ReferenceError
PASS Valid: "function f() { switch (l) { case 1: a: with(g) switch (g) { case 2: default: } default: } }"
PASS Invalid: "switch (4 - ) { }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { switch (4 - ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "switch (l) { default case: 5; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Expected a ':' after switch default clause."
PASS Invalid: "function f() { switch (l) { default case: 5; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'case'. Expected a ':' after switch default clause."
PASS Invalid: "L: L: ;". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "function f() { L: L: ; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "L: L1: L: ;". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "function f() { L: L1: L: ; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "L: L1: L2: L3: L4: L: ;". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "function f() { L: L1: L2: L3: L4: L: ; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Attempted to redeclare the label 'L'."
PASS Invalid: "for(var a,b 'this shouldn't be allowed' false ; ) ;". Produced the following syntax error: "SyntaxError: Unexpected string literal 'this shouldn'. can only declare a single variable in an enumeration."
PASS Invalid: "function f() { for(var a,b 'this shouldn't be allowed' false ; ) ; }". Produced the following syntax error: "SyntaxError: Unexpected string literal 'this shouldn'. can only declare a single variable in an enumeration."
PASS Invalid: "for(var a,b '". Produced the following syntax error: "SyntaxError: Unexpected EOF"
PASS Invalid: "function f() { for(var a,b ' }". Produced the following syntax error: "SyntaxError: Unexpected EOF"
PASS Valid: "function __proto__(){}"
PASS Valid: "function f() { function __proto__(){} }"
PASS Valid: "(function __proto__(){})"
PASS Valid: "function f() { (function __proto__(){}) }"
PASS Valid: "'use strict'; function __proto__(){}"
PASS Valid: "function f() { 'use strict'; function __proto__(){} }"
PASS Valid: "'use strict'; (function __proto__(){})"
PASS Valid: "function f() { 'use strict'; (function __proto__(){}) }"
PASS Valid: "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } f1(5);"
PASS Valid: "function f() { 'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } f1(5); }"
PASS Valid: "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } f1(5);"
PASS Valid: "function f() { 'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } f1(5); }"
PASS Valid: "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } f1(5);"
PASS Valid: "function f() { 'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } f1(5); }"
PASS Valid: "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } f1(5);"
PASS Valid: "function f() { 'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } f1(5); }"
PASS Valid: "'use strict'; function f1(a) {}; function f1(a) {};"
PASS Valid: "function f() { 'use strict'; function f1(a) {}; function f1(a) {}; }"
PASS Invalid: "'use strict'; { function f1(a) {}; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { 'use strict'; { function f1(a) {}; function f1(a) {}; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "'use strict'; { let f1; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { 'use strict'; { let f1; function f1(a) {}; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "'use strict'; { function f1(a) {}; let f1; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "function f() { 'use strict'; { function f1(a) {}; let f1; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "'use strict'; let f1; function f1(a) {};". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { 'use strict'; let f1; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "'use strict'; function f1(a) {}; let f1; ". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "function f() { 'use strict'; function f1(a) {}; let f1; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "let f1; function f1(a) {};". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { let f1; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Valid: "function foo() { let f1; { function f1(a) {}; } }"
PASS Valid: "function f() { function foo() { let f1; { function f1(a) {}; } } }"
PASS Valid: "function foo() { { function f1(a) {}; } let f1; }"
PASS Valid: "function f() { function foo() { { function f1(a) {}; } let f1; } }"
PASS Valid: "function foo() { { function foo() { }; function foo() { } } }"
PASS Valid: "function f() { function foo() { { function foo() { }; function foo() { } } } }"
PASS Invalid: "function foo() { 'use strict'; { function foo() { }; function foo() { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "function f() { function foo() { 'use strict'; { function foo() { }; function foo() { } } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "function foo() { let f1; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { function foo() { let f1; function f1(a) {}; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "let f1; function f1(a) {};". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "function f() { let f1; function f1(a) {}; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'f1' in strict mode."
PASS Invalid: "{ function f1(a) {}; let f1; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "function f() { { function f1(a) {}; let f1; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'f1'."
PASS Invalid: "{ function f1(a) {}; const f1 = 25; }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'f1'."
PASS Invalid: "function f() { { function f1(a) {}; const f1 = 25; } }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'f1'."
PASS Invalid: "{ function f1(a) {}; class f1{}; }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'f1'."
PASS Invalid: "function f() { { function f1(a) {}; class f1{}; } }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'f1'."
PASS Invalid: "function foo() { { let bar; function bar() { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'bar' in strict mode."
PASS Invalid: "function f() { function foo() { { let bar; function bar() { } } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'bar' in strict mode."
PASS Invalid: "function foo() { { function bar() { }; let bar; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'bar'."
PASS Invalid: "function f() { function foo() { { function bar() { }; let bar; } } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'bar'."
PASS Invalid: "function foo() { { const bar; function bar() { } } }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const declared variable 'bar' must have an initializer."
PASS Invalid: "function f() { function foo() { { const bar; function bar() { } } } }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. const declared variable 'bar' must have an initializer."
PASS Invalid: "function foo() { { function bar() { }; const bar; } }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'bar'."
PASS Invalid: "function f() { function foo() { { function bar() { }; const bar; } } }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'bar'."
PASS Invalid: "function foo() { { class bar{}; function bar() { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'bar' in strict mode."
PASS Invalid: "function f() { function foo() { { class bar{}; function bar() { } } } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'bar' in strict mode."
PASS Invalid: "function foo() { { function bar() { }; class bar{}; } }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'bar'."
PASS Invalid: "function f() { function foo() { { function bar() { }; class bar{}; } } }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'bar'."
PASS Valid: "switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; }"
PASS Valid: "function f() { switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; } }"
PASS Invalid: "switch('foo') { case 1: let foo; function foo() {}; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "function f() { switch('foo') { case 1: let foo; function foo() {}; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "switch('foo') { case 1: function foo() {}; let foo; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Invalid: "function f() { switch('foo') { case 1: function foo() {}; let foo; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Invalid: "switch('foo') { case 1: function foo() {}; const foo = 25; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'foo'."
PASS Invalid: "function f() { switch('foo') { case 1: function foo() {}; const foo = 25; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a const variable twice: 'foo'."
PASS Invalid: "switch('foo') { case 1: function foo() {}; class foo {} ; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'foo'."
PASS Invalid: "function f() { switch('foo') { case 1: function foo() {}; class foo {} ; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a class twice: 'foo'."
PASS Invalid: "switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; case 3: let foo; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Invalid: "function f() { switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; case 3: let foo; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Valid: "function foo() { switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; case 3: { let foo; } } }"
PASS Valid: "function f() { function foo() { switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; case 3: { let foo; } } } }"
PASS Invalid: "'use strict'; switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "function f() { 'use strict'; switch('foo') { case 1: function foo() {}; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "'use strict'; switch('foo') { case 1: function foo() {}; break; case 2: let foo; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Invalid: "function f() { 'use strict'; switch('foo') { case 1: function foo() {}; break; case 2: let foo; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a let variable twice: 'foo'."
PASS Invalid: "'use strict'; switch('foo') { case 1: let foo; break; case 2: function foo() {}; break; }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Invalid: "function f() { 'use strict'; switch('foo') { case 1: let foo; break; case 2: function foo() {}; break; } }". Produced the following syntax error: "SyntaxError: Cannot declare a function that shadows a let/const/class/function variable 'foo' in strict mode."
PASS Valid: "'use strict'; switch('foo') { case 1: { let foo; break; } case 2: function foo() {}; break; }"
PASS Valid: "function f() { 'use strict'; switch('foo') { case 1: { let foo; break; } case 2: function foo() {}; break; } }"
PASS Valid: "'use strict'; switch('foo') { case 1: { function foo() { }; break; } case 2: function foo() {}; break; }"
PASS Valid: "function f() { 'use strict'; switch('foo') { case 1: { function foo() { }; break; } case 2: function foo() {}; break; } }"
PASS Invalid: "'use strict'; if (true) function foo() { }; ". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "function f() { 'use strict'; if (true) function foo() { }; }". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Valid: "if (true) function foo() { }; "
PASS Valid: "function f() { if (true) function foo() { }; }"
PASS Valid: " let foo; if (true) function foo() { };"
PASS Valid: "function f() { let foo; if (true) function foo() { }; }"
PASS Valid: "function baz() { let foo; if (true) function foo() { }; }"
PASS Valid: "function f() { function baz() { let foo; if (true) function foo() { }; } }"
PASS Valid: "if (true) function foo() { }; let foo;"
PASS Valid: "function f() { if (true) function foo() { }; let foo; }"
PASS Valid: "{ if (true) function foo() { }; } let foo;"
PASS Valid: "function f() { { if (true) function foo() { }; } let foo; }"
PASS Invalid: "let foo; while (false) function foo() { }; ". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { let foo; while (false) function foo() { }; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "let foo; { while (false) function foo() { }; } ". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { let foo; { while (false) function foo() { }; } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "while (false) function foo() { }; let foo;". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { while (false) function foo() { }; let foo; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "let foo; while (false) label: function foo() { }; ". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { let foo; while (false) label: function foo() { }; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "while (false) label: function foo() { }; let foo;". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { while (false) label: function foo() { }; let foo; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "'use strict'; while (false) function foo() { }; ". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "function f() { 'use strict'; while (false) function foo() { }; }". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "'use strict'; if (false) function foo() { }; ". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "function f() { 'use strict'; if (false) function foo() { }; }". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "'use strict'; do function foo() { } while (false); ". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "function f() { 'use strict'; do function foo() { } while (false); }". Produced the following syntax error: "SyntaxError: Function declarations are only allowed inside blocks or switch statements in strict mode."
PASS Invalid: "while (false) function foo() { }; ". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { while (false) function foo() { }; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Valid: "if (false) function foo() { }; "
PASS Valid: "function f() { if (false) function foo() { }; }"
PASS Invalid: "do function foo() { } while (false); ". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { do function foo() { } while (false); }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "if (cond) label: function foo() { }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { if (cond) label: function foo() { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "while (true) { while (true) function bar() { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { while (true) { while (true) function bar() { } } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "with ({}) function bar() { }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { with ({}) function bar() { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Valid: "function bar() { label: function baz() { } }"
PASS Valid: "function f() { function bar() { label: function baz() { } } }"
PASS Valid: "function bar() { let: function baz() { } }"
PASS Valid: "function f() { function bar() { let: function baz() { } } }"
PASS Invalid: "function bar() { 'use strict'; let: function baz() { } }". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { function bar() { 'use strict'; let: function baz() { } } }". Produced the following syntax error: "SyntaxError: Unexpected token ':'. Expected a parameter pattern or a ')' in parameter list."
PASS Valid: "function bar() { yield: function baz() { } }"
PASS Valid: "function f() { function bar() { yield: function baz() { } } }"
PASS Valid: "function bar() { label: label2: function baz() { } }"
PASS Valid: "function f() { function bar() { label: label2: function baz() { } } }"
PASS Valid: "function bar() { label: label2: label3: function baz() { } }"
PASS Valid: "function f() { function bar() { label: label2: label3: function baz() { } } }"
PASS Invalid: "function bar() { label: label2: label weird: function baz() { } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'weird'"
PASS Invalid: "function f() { function bar() { label: label2: label weird: function baz() { } } }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'weird'"
PASS Valid: "function bar() { label: label2: label3: function baz() { } }"
PASS Valid: "function f() { function bar() { label: label2: label3: function baz() { } } }"
PASS Invalid: "function bar() { 'use strict'; label: label2: label 3: function baz() { } }". Produced the following syntax error: "SyntaxError: Unexpected number '3'"
PASS Invalid: "function f() { function bar() { 'use strict'; label: label2: label 3: function baz() { } } }". Produced the following syntax error: "SyntaxError: Unexpected number '3'"
PASS Invalid: "function bar() { if (cond) label: function foo() { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { function bar() { if (cond) label: function foo() { } } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function bar() { while (cond) label: function foo() { } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Invalid: "function f() { function bar() { while (cond) label: function foo() { } } }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'function'. Function declarations are only allowed inside block statements or at the top level of a program."
PASS Valid: "label: function foo() { }"
PASS Valid: "function f() { label: function foo() { } }"
PASS Valid: "let: function foo() { }"
PASS Valid: "function f() { let: function foo() { } }"
PASS Valid: "yield: function foo() { }"
PASS Valid: "function f() { yield: function foo() { } }"
PASS Valid: "yield: let: function foo() { }"
PASS Valid: "function f() { yield: let: function foo() { } }"
PASS Invalid: "'use strict'; yield: let: function foo() { }". Produced the following syntax error: "SyntaxError: Cannot use 'yield' as a label in strict mode."
PASS Invalid: "function f() { 'use strict'; yield: let: function foo() { } }". Produced the following syntax error: "SyntaxError: Cannot use 'yield' as a label in strict mode."
PASS Valid: "var str = "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
PASS Valid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
PASS Valid: "var str = "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
PASS Valid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { function f3(c) { return c; } return f3(b); } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
PASS Valid: "var str = "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
PASS Valid: "function f() { var str = "'use strict'; function f1(a) { if (a) { function f2(b) { return b; } return f2(a); } else return a; } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
PASS Valid: "var str = "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5);"
PASS Valid: "function f() { var str = "'use strict'; function f1(a) { function f2(b) { if (b) { function f3(c) { return c; } return f3(b); } else return b; } return f2(a); } return f1(arguments[0]);"; var foo = new Function(str); foo(5); }"
PASS Valid: "if (0) $foo; "
PASS Valid: "function f() { if (0) $foo; }"
PASS Valid: "if (0) _foo; "
PASS Valid: "function f() { if (0) _foo; }"
PASS Valid: "if (0) foo$; "
PASS Valid: "function f() { if (0) foo$; }"
PASS Valid: "if (0) foo_; "
PASS Valid: "function f() { if (0) foo_; }"
PASS Valid: "if (0) obj.$foo; "
PASS Valid: "function f() { if (0) obj.$foo; }"
PASS Valid: "if (0) obj._foo; "
PASS Valid: "function f() { if (0) obj._foo; }"
PASS Valid: "if (0) obj.foo$; "
PASS Valid: "function f() { if (0) obj.foo$; }"
PASS Valid: "if (0) obj.foo_; "
PASS Valid: "function f() { if (0) obj.foo_; }"
PASS Valid: "if (0) obj.foo\u03bb; "
PASS Valid: "function f() { if (0) obj.foo\u03bb; }"
PASS Valid: "if (0) new a(b+c).d = 5"
PASS Valid: "function f() { if (0) new a(b+c).d = 5 }"
PASS Invalid: "if (0) new a(b+c) = 5". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { if (0) new a(b+c) = 5 }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Valid: "([1 || 1].a = 1)"
PASS Valid: "function f() { ([1 || 1].a = 1) }"
PASS Valid: "({a: 1 || 1}.a = 1)"
PASS Valid: "function f() { ({a: 1 || 1}.a = 1) }"
PASS Invalid: "var a.b = c". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var a.b = c }". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected ';' after variable declaration."
PASS Invalid: "var a.b;". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var a.b; }". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected ';' after variable declaration."
PASS Valid: "for (of of of){}" with ReferenceError
PASS Valid: "function f() { for (of of of){} }"
PASS Valid: "for (of; of; of){}" with ReferenceError
PASS Valid: "function f() { for (of; of; of){} }"
PASS Valid: "for (var of of of){}" with TypeError
PASS Valid: "function f() { for (var of of of){} }"
PASS Valid: "for (var of; of; of){}"
PASS Valid: "function f() { for (var of; of; of){} }"
PASS Invalid: "for (var of.of of of){}". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var of.of of of){} }". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "for (var of[of] of of){}". Produced the following syntax error: "SyntaxError: Unexpected token '['. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var of[of] of of){} }". Produced the following syntax error: "SyntaxError: Unexpected token '['. Expected either 'in' or 'of' in enumeration syntax."
PASS Valid: "for (of.of of of){}" with ReferenceError
PASS Valid: "function f() { for (of.of of of){} }"
PASS Valid: "for (of[of] of of){}" with ReferenceError
PASS Valid: "function f() { for (of[of] of of){} }"
PASS Valid: "for (var [of] of of){}" with TypeError
PASS Valid: "function f() { for (var [of] of of){} }"
PASS Valid: "for (var {of} of of){}" with TypeError
PASS Valid: "function f() { for (var {of} of of){} }"
PASS Valid: "for (of in of){}" with ReferenceError
PASS Valid: "function f() { for (of in of){} }"
PASS Valid: "for (var of in of){}"
PASS Valid: "function f() { for (var of in of){} }"
PASS Invalid: "for (var of.of in of){}". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var of.of in of){} }". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected either 'in' or 'of' in enumeration syntax."
PASS Valid: "for (of.of in of){}" with ReferenceError
PASS Valid: "function f() { for (of.of in of){} }"
PASS Valid: "for (of[of] in of){}" with ReferenceError
PASS Valid: "function f() { for (of[of] in of){} }"
PASS Invalid: "for (var of[of] in of){}". Produced the following syntax error: "SyntaxError: Unexpected token '['. Expected either 'in' or 'of' in enumeration syntax."
PASS Invalid: "function f() { for (var of[of] in of){} }". Produced the following syntax error: "SyntaxError: Unexpected token '['. Expected either 'in' or 'of' in enumeration syntax."
PASS Valid: "for (var [of] in of){}"
PASS Valid: "function f() { for (var [of] in of){} }"
PASS Valid: "for (var {of} in of){}"
PASS Valid: "function f() { for (var {of} in of){} }"
PASS Valid: "for ([of] in of){}" with ReferenceError
PASS Valid: "function f() { for ([of] in of){} }"
PASS Valid: "for ({of} in of){}" with ReferenceError
PASS Valid: "function f() { for ({of} in of){} }"
PASS Invalid: "for (var of = x of of){}". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var of = x of of){} }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (var {of} = x of of){}". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var {of} = x of of){} }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (var [of] = x of of){}". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "function f() { for (var [of] = x of of){} }". Produced the following syntax error: "SyntaxError: Cannot assign to the loop variable inside a for-of loop header."
PASS Invalid: "for (of of of of){}". Produced the following syntax error: "SyntaxError: Unexpected identifier 'of'. Expected ')' to end a for-of header."
PASS Invalid: "function f() { for (of of of of){} }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'of'. Expected ')' to end a for-of header."
PASS Invalid: "for (of of; of; of){}". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "function f() { for (of of; of; of){} }". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "for (of of []; of; of){}". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Expected ')' to end a for-of header."
PASS Invalid: "function f() { for (of of []; of; of){} }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Expected ')' to end a for-of header."
PASS Invalid: "for (of of){}". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for (of of){} }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for (var of of){}". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for (var of of){} }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for (of of in of){}". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'"
PASS Invalid: "function f() { for (of of in of){} }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'in'"
PASS Invalid: "for (of in){}". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for (of in){} }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "for (var of in){}". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { for (var of in){} }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
spread operator and destructuring
PASS Valid: "foo(...bar)" with ReferenceError
PASS Valid: "function f() { foo(...bar) }"
PASS Valid: "o.foo(...bar)" with ReferenceError
PASS Valid: "function f() { o.foo(...bar) }"
PASS Valid: "o[foo](...bar)" with ReferenceError
PASS Valid: "function f() { o[foo](...bar) }"
PASS Valid: "new foo(...bar)" with ReferenceError
PASS Valid: "function f() { new foo(...bar) }"
PASS Valid: "new o.foo(...bar)" with ReferenceError
PASS Valid: "function f() { new o.foo(...bar) }"
PASS Valid: "new o[foo](...bar)" with ReferenceError
PASS Valid: "function f() { new o[foo](...bar) }"
PASS Invalid: "foo(...)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { foo(...) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "o.foo(...)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { o.foo(...) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "o[foo](...)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { o[foo](...) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "foo(bar...)". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Invalid: "function f() { foo(bar...) }". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Invalid: "o.foo(bar...)". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Invalid: "function f() { o.foo(bar...) }". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Invalid: "o[foo](bar...)". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Invalid: "function f() { o[foo](bar...) }". Produced the following syntax error: "SyntaxError: The '...' operator should come before the target expression."
PASS Valid: "foo(a,...bar)" with ReferenceError
PASS Valid: "function f() { foo(a,...bar) }"
PASS Valid: "o.foo(a,...bar)" with ReferenceError
PASS Valid: "function f() { o.foo(a,...bar) }"
PASS Valid: "o[foo](a,...bar)" with ReferenceError
PASS Valid: "function f() { o[foo](a,...bar) }"
PASS Valid: "foo(...bar, a)" with ReferenceError
PASS Valid: "function f() { foo(...bar, a) }"
PASS Valid: "o.foo(...bar, a)" with ReferenceError
PASS Valid: "function f() { o.foo(...bar, a) }"
PASS Valid: "o[foo](...bar, a)" with ReferenceError
PASS Valid: "function f() { o[foo](...bar, a) }"
PASS Valid: "[...bar]" with ReferenceError
PASS Valid: "function f() { [...bar] }"
PASS Valid: "[a, ...bar]" with ReferenceError
PASS Valid: "function f() { [a, ...bar] }"
PASS Valid: "[...bar, a]" with ReferenceError
PASS Valid: "function f() { [...bar, a] }"
PASS Valid: "[...bar,,,,]" with ReferenceError
PASS Valid: "function f() { [...bar,,,,] }"
PASS Valid: "[,,,,...bar]" with ReferenceError
PASS Valid: "function f() { [,,,,...bar] }"
PASS Valid: "({1: x})" with ReferenceError
PASS Valid: "function f() { ({1: x}) }"
PASS Valid: "({1: x}=1)"
PASS Valid: "function f() { ({1: x}=1) }"
PASS Valid: "({1: x}=null)" with TypeError
PASS Valid: "function f() { ({1: x}=null) }"
PASS Valid: "({1: x})"
PASS Valid: "function f() { ({1: x}) }"
PASS Valid: "({1: x}=1)"
PASS Valid: "function f() { ({1: x}=1) }"
PASS Valid: "({1: x}=null)" with TypeError
PASS Valid: "function f() { ({1: x}=null) }"
PASS Valid: "({a: b}=null)" with TypeError
PASS Valid: "function f() { ({a: b}=null) }"
PASS Valid: "'use strict'; ({1: x})"
PASS Valid: "function f() { 'use strict'; ({1: x}) }"
PASS Valid: "'use strict'; ({1: x}=1)"
PASS Valid: "function f() { 'use strict'; ({1: x}=1) }"
PASS Valid: "'use strict'; ({1: x}=null)" with TypeError
PASS Valid: "function f() { 'use strict'; ({1: x}=null) }"
PASS Valid: "'use strict'; ({a: b}=null)" with TypeError
PASS Valid: "function f() { 'use strict'; ({a: b}=null) }"
PASS Valid: "var {1:x}=1"
PASS Valid: "function f() { var {1:x}=1 }"
PASS Valid: "var {x}=1"
PASS Valid: "function f() { var {x}=1 }"
PASS Valid: "var {x, y}=1"
PASS Valid: "function f() { var {x, y}=1 }"
PASS Valid: "var [x]=1" with TypeError
PASS Valid: "function f() { var [x]=1 }"
PASS Valid: "var [x, y]=1" with TypeError
PASS Valid: "function f() { var [x, y]=1 }"
PASS Valid: "[x]=1" with TypeError
PASS Valid: "function f() { [x]=1 }"
PASS Valid: "var [x]=1" with TypeError
PASS Valid: "function f() { var [x]=1 }"
PASS Valid: "({[x]: 1})"
PASS Valid: "function f() { ({[x]: 1}) }"
PASS Valid: "delete ({a}=1)"
PASS Valid: "function f() { delete ({a}=1) }"
PASS Valid: "delete ({a:a}=1)"
PASS Valid: "function f() { delete ({a:a}=1) }"
PASS Valid: "({a}=1)()" with TypeError
PASS Valid: "function f() { ({a}=1)() }"
PASS Valid: "({a:a}=1)()" with TypeError
PASS Valid: "function f() { ({a:a}=1)() }"
PASS Invalid: "({a}=1)=1". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { ({a}=1)=1 }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "({a:a}=1)=1". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { ({a:a}=1)=1 }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "({a}=1=1)". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { ({a}=1=1) }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "({a:a}=1=1)". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "function f() { ({a:a}=1=1) }". Produced the following syntax error: "SyntaxError: Left side of assignment is not a reference."
PASS Invalid: "var {x}". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var {x} }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var {x, y}". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var {x, y} }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var {x} = 20, {x, y}". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var {x} = 20, {x, y} }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var {foo:bar, bar:baz}". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var {foo:bar, bar:baz} }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var [x]". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var [x] }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var [x, y]". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var [x, y] }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Invalid: "var [x] = [], [x, y]". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var [x] = [], [x, y] }". Produced the following syntax error: "SyntaxError: Unexpected token '}'. Expected an initializer in destructuring variable declaration."
PASS Valid: "({get x(){}})"
PASS Valid: "function f() { ({get x(){}}) }"
PASS Valid: "({set x(x){}})"
PASS Valid: "function f() { ({set x(x){}}) }"
PASS Invalid: "({get x(a){}})". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. getter functions must have no parameters."
PASS Invalid: "function f() { ({get x(a){}}) }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. getter functions must have no parameters."
PASS Invalid: "({get x(a,b){}})". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. getter functions must have no parameters."
PASS Invalid: "function f() { ({get x(a,b){}}) }". Produced the following syntax error: "SyntaxError: Unexpected identifier 'a'. getter functions must have no parameters."
PASS Invalid: "({set x(){}})". Produced the following syntax error: "SyntaxError: Unexpected token ')'. setter functions must have one parameter."
PASS Invalid: "function f() { ({set x(){}}) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. setter functions must have one parameter."
PASS Invalid: "({set x(a,b){}})". Produced the following syntax error: "SyntaxError: Unexpected token ','. setter functions must have one parameter."
PASS Invalid: "function f() { ({set x(a,b){}}) }". Produced the following syntax error: "SyntaxError: Unexpected token ','. setter functions must have one parameter."
PASS Valid: "({get [x](){}})"
PASS Valid: "function f() { ({get [x](){}}) }"
PASS Invalid: "({get [x (){}})". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ']' to end a computed property name."
PASS Invalid: "function f() { ({get [x (){}}) }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ']' to end a computed property name."
PASS Invalid: "({set [x](){}})". Produced the following syntax error: "SyntaxError: Unexpected token ')'. setter functions must have one parameter."
PASS Invalid: "function f() { ({set [x](){}}) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'. setter functions must have one parameter."
PASS Valid: "({set [x](x){}})"
PASS Valid: "function f() { ({set [x](x){}}) }"
PASS Invalid: "({set [x (x){}})". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ']' to end a computed property name."
PASS Invalid: "function f() { ({set [x (x){}}) }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected ']' to end a computed property name."
PASS Valid: "({set foo(x) { } })"
PASS Valid: "function f() { ({set foo(x) { } }) }"
PASS Valid: "({set foo(x) { 'use strict'; } })"
PASS Valid: "function f() { ({set foo(x) { 'use strict'; } }) }"
PASS Invalid: "({set foo(x = 20) { 'use strict'; } })". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { ({set foo(x = 20) { 'use strict'; } }) }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "({set foo({x}) { 'use strict'; } })". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { ({set foo({x}) { 'use strict'; } }) }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "({set foo([x]) { 'use strict'; } })". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { ({set foo([x]) { 'use strict'; } }) }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "({set foo(...x) {} })". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { ({set foo(...x) {} }) }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Valid: "class Foo { set v(z) { } }"
PASS Valid: "function f() { class Foo { set v(z) { } } }"
PASS Valid: "class Foo { set v(z) { 'use strict'; } }"
PASS Valid: "function f() { class Foo { set v(z) { 'use strict'; } } }"
PASS Invalid: "class Foo { set v(z = 50) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { class Foo { set v(z = 50) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "class Foo { set v({z}) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { class Foo { set v({z}) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "class Foo { set v([z]) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { class Foo { set v([z]) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "class Foo { set v(...z) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { class Foo { set v(...z) { } } }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "class foo { set y([x, y, x]) { } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "function f() { class foo { set y([x, y, x]) { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "class foo { set y([x, y, {x}]) { } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "function f() { class foo { set y([x, y, {x}]) { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "class foo { set y({x, x}) { } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "function f() { class foo { set y({x, x}) { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "class foo { set y({x, field: {x}}) { } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Invalid: "function f() { class foo { set y({x, field: {x}}) { } } }". Produced the following syntax error: "SyntaxError: Cannot declare a parameter named 'x' in strict mode as it has already been declared."
PASS Valid: "class foo { set y({x, field: {xx}}) { } }"
PASS Valid: "function f() { class foo { set y({x, field: {xx}}) { } } }"
PASS Invalid: "({[...x]: 1})". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "function f() { ({[...x]: 1}) }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "function f({a, a}) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { function f({a, a}) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f({a}, a) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { function f({a}, a) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f([b, b]) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { function f([b, b]) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Invalid: "function f([b], b) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { function f([b], b) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Invalid: "function f({a: {b}}, b) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { function f({a: {b}}, b) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in function with destructuring parameters."
PASS Valid: "function f(a, b = 20) {}"
PASS Valid: "function f() { function f(a, b = 20) {} }"
PASS Valid: "function f(a = 20, b = a) {}"
PASS Valid: "function f() { function f(a = 20, b = a) {} }"
PASS Valid: "function f({a = 20} = {a: 40}, b = a) {}"
PASS Valid: "function f() { function f({a = 20} = {a: 40}, b = a) {} }"
PASS Valid: "function f([a,b,c] = [1,2,3]) {}"
PASS Valid: "function f() { function f([a,b,c] = [1,2,3]) {} }"
PASS Invalid: "function f(a, a=20) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f() { function f(a, a=20) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f({a} = 20, a=20) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f() { function f({a} = 20, a=20) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f([a,b,a] = [1,2,3]) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f() { function f([a,b,a] = [1,2,3]) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f([a,b,c] = [1,2,3], a) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f() { function f([a,b,c] = [1,2,3], a) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f([a,b,c] = [1,2,3], {a}) {}". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Invalid: "function f() { function f([a,b,c] = [1,2,3], {a}) {} }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with default parameter values."
PASS Valid: "( function(){ return this || eval('this'); }().x = 'y' )"
PASS Valid: "function f() { ( function(){ return this || eval('this'); }().x = 'y' ) }"
PASS Invalid: "function(){ return this || eval('this'); }().x = 'y'". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Invalid: "function f() { function(){ return this || eval('this'); }().x = 'y' }". Produced the following syntax error: "SyntaxError: Function statements must have a name."
PASS Invalid: "1 % +". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % + }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % -". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % - }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % typeof". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % typeof }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % void". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % void }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % !". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % ! }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % ~". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % ~ }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % delete". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % delete }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % ++". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % ++ }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 % --". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 % -- }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 %
++". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 %
++ }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "1 %
--". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { 1 %
-- }". Produced the following syntax error: "SyntaxError: Unexpected token '}'"
PASS Invalid: "let {w} = (foo-=()), {} = ("a" ^= "b");". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { let {w} = (foo-=()), {} = ("a" ^= "b"); }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "const {w} = (foo-=()), {} = ("a" ^= "b");". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { const {w} = (foo-=()), {} = ("a" ^= "b"); }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "var {w} = (foo-=()), {} = ("a" ^= "b");". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { var {w} = (foo-=()), {} = ("a" ^= "b"); }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "let {w} = ();". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { let {w} = (); }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "let {w} = 1234abc;". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "function f() { let {w} = 1234abc; }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "const {w} = 1234abc;". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "function f() { const {w} = 1234abc; }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "var {w} = 1234abc;". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "function f() { var {w} = 1234abc; }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "var [...x = 20] = 20;". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing ']' following a rest element destructuring pattern."
PASS Invalid: "function f() { var [...x = 20] = 20; }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing ']' following a rest element destructuring pattern."
PASS Invalid: "var [...[...x = 20]] = 20;". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing ']' following a rest element destructuring pattern."
PASS Invalid: "function f() { var [...[...x = 20]] = 20; }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing ']' following a rest element destructuring pattern."
PASS Valid: "var [...x] = 20;" with TypeError
PASS Valid: "function f() { var [...x] = 20; }"
PASS Valid: "var [...[...x]] = 20;" with TypeError
PASS Valid: "function f() { var [...[...x]] = 20; }"
PASS Valid: "var [...[...{x}]] = 20;" with TypeError
PASS Valid: "function f() { var [...[...{x}]] = 20; }"
PASS Valid: "var [...[x = 20, ...y]] = 20;" with TypeError
PASS Valid: "function f() { var [...[x = 20, ...y]] = 20; }"
PASS Valid: "var [...[{x} = 20, ...y]] = 20;" with TypeError
PASS Valid: "function f() { var [...[{x} = 20, ...y]] = 20; }"
PASS Valid: "var {x: [y, ...[...[...{z: [...z]}]]]} = 20" with TypeError
PASS Valid: "function f() { var {x: [y, ...[...[...{z: [...z]}]]]} = 20 }"
PASS Valid: "var {x: [y, {z: {z: [...z]}}]} = 20" with TypeError
PASS Valid: "function f() { var {x: [y, {z: {z: [...z]}}]} = 20 }"
PASS Invalid: "var [...y, ...z] = 20". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing ']' following a rest element destructuring pattern."
PASS Invalid: "function f() { var [...y, ...z] = 20 }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing ']' following a rest element destructuring pattern."
PASS Valid: "var [...{...y}] = 20" with TypeError
PASS Valid: "function f() { var [...{...y}] = 20 }"
PASS Valid: "var {a, b, ...r} = {a: 1, b: 2, c: 3};"
PASS Valid: "function f() { var {a, b, ...r} = {a: 1, b: 2, c: 3}; }"
PASS Invalid: "var {a, b, ...{d}} = {a: 1, b: 2, c: 3, d: 4};". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Invalid: "function f() { var {a, b, ...{d}} = {a: 1, b: 2, c: 3, d: 4}; }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Invalid: "var {a, b, ...{d = 15}} = {a: 1, b: 2, c: 3, d: 4};". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Invalid: "function f() { var {a, b, ...{d = 15}} = {a: 1, b: 2, c: 3, d: 4}; }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Invalid: "var {a, b, ...{d = 15, ...r}} = {a: 1, b: 2, c: 3, d: 4};". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Invalid: "function f() { var {a, b, ...{d = 15, ...r}} = {a: 1, b: 2, c: 3, d: 4}; }". Produced the following syntax error: "SyntaxError: Unexpected token '{'. Expected a binding element."
PASS Valid: "(({a, b, ...r}) => {})({a: 1, b: 2, c: 3, d: 4});"
PASS Valid: "function f() { (({a, b, ...r}) => {})({a: 1, b: 2, c: 3, d: 4}); }"
PASS Valid: "(function ({a, b, ...r}) {})({a: 1, b: 2, c: 3, d: 4});"
PASS Valid: "function f() { (function ({a, b, ...r}) {})({a: 1, b: 2, c: 3, d: 4}); }"
PASS Valid: "var a, b, c; ({a, b, ...r} = {a: 1, b: 2, c: 3, d: 4});"
PASS Valid: "function f() { var a, b, c; ({a, b, ...r} = {a: 1, b: 2, c: 3, d: 4}); }"
PASS Valid: "try { throw {a:2} } catch({...rest}) {}"
PASS Valid: "function f() { try { throw {a:2} } catch({...rest}) {} }"
PASS Valid: "let c = {}; let o = {a: 1, b: 2, ...c};"
PASS Valid: "function f() { let c = {}; let o = {a: 1, b: 2, ...c}; }"
PASS Valid: "let o = {a: 1, b: 3, ...{}};"
PASS Valid: "function f() { let o = {a: 1, b: 3, ...{}}; }"
PASS Valid: "let o = {a: 1, b: 2, ...null, c: 3};"
PASS Valid: "function f() { let o = {a: 1, b: 2, ...null, c: 3}; }"
PASS Valid: "let o = {a: 1, b: 2, ...undefined, c: 3};"
PASS Valid: "function f() { let o = {a: 1, b: 2, ...undefined, c: 3}; }"
PASS Valid: "let o = {a: 1, b: 2, ...{...{}}, c: 3};"
PASS Valid: "function f() { let o = {a: 1, b: 2, ...{...{}}, c: 3}; }"
PASS Valid: "let c = {}; let o = {a: 1, b: 2, ...c, d: 3, ...c, e: 5};"
PASS Valid: "function f() { let c = {}; let o = {a: 1, b: 2, ...c, d: 3, ...c, e: 5}; }"
PASS Valid: "let o = {a: 1, b: 2, ...d = {e: 2}, c: 3};"
PASS Valid: "function f() { let o = {a: 1, b: 2, ...d = {e: 2}, c: 3}; }"
PASS Valid: "let p = true; let o = {a: 1, b: 2, ...d = p ? {e: 2} : {f: 4}, c: 3};"
PASS Valid: "function f() { let p = true; let o = {a: 1, b: 2, ...d = p ? {e: 2} : {f: 4}, c: 3}; }"
PASS Valid: "let o = {a: 1, b: 2, ...(a) => 3, c: 3};"
PASS Valid: "function f() { let o = {a: 1, b: 2, ...(a) => 3, c: 3}; }"
PASS Valid: "function * foo() { return {a: 1, b: 2, ...yield, c: 3}; }"
PASS Valid: "function f() { function * foo() { return {a: 1, b: 2, ...yield, c: 3}; } }"
PASS Invalid: "function * foo(o) { ({...{ x = yield }} = o); }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ':' following the property name 'x'."
PASS Invalid: "function f() { function * foo(o) { ({...{ x = yield }} = o); } }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ':' following the property name 'x'."
PASS Invalid: "var {...r = {a: 2}} = {a: 1, b: 2};". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "function f() { var {...r = {a: 2}} = {a: 1, b: 2}; }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "var {...r, b} = {a: 1, b: 2};". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "function f() { var {...r, b} = {a: 1, b: 2}; }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "var {...r, ...e} = {a: 1, b: 2};". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "function f() { var {...r, ...e} = {a: 1, b: 2}; }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "({...new Object()} = {a: 1, b: 2});". Produced the following syntax error: "SyntaxError: Invalid destructuring assignment target."
PASS Invalid: "function f() { ({...new Object()} = {a: 1, b: 2}); }". Produced the following syntax error: "SyntaxError: Invalid destructuring assignment target."
PASS Invalid: "(function * (o) { ({ ...{ x: yield } } = o); })()". Produced the following syntax error: "SyntaxError: Invalid destructuring assignment target."
PASS Invalid: "function f() { (function * (o) { ({ ...{ x: yield } } = o); })() }". Produced the following syntax error: "SyntaxError: Invalid destructuring assignment target."
PASS Invalid: "(function () {'use strict'; ({...eval} = {}); })()". Produced the following syntax error: "SyntaxError: Cannot modify 'eval' in strict mode."
PASS Invalid: "function f() { (function () {'use strict'; ({...eval} = {}); })() }". Produced the following syntax error: "SyntaxError: Cannot modify 'eval' in strict mode."
PASS Invalid: "(function () {'use strict'; ({...arguments} = {}); })()". Produced the following syntax error: "SyntaxError: Cannot modify 'arguments' in strict mode."
PASS Invalid: "function f() { (function () {'use strict'; ({...arguments} = {}); })() }". Produced the following syntax error: "SyntaxError: Cannot modify 'arguments' in strict mode."
PASS Invalid: "async function foo () { let {...await} = {}; }". Produced the following syntax error: "SyntaxError: Cannot use 'await' as a lexical variable name in an async function."
PASS Invalid: "function f() { async function foo () { let {...await} = {}; } }". Produced the following syntax error: "SyntaxError: Cannot use 'await' as a lexical variable name in an async function."
PASS Invalid: "let {...let} = {a: 1, b: 2};". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { let {...let} = {a: 1, b: 2}; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "const {...let} = {a: 1, b: 2};". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "function f() { const {...let} = {a: 1, b: 2}; }". Produced the following syntax error: "SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration."
PASS Invalid: "try { throw {a:2} } catch({...foo.a}) {}". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected a closing '}' following a rest element destructuring pattern."
PASS Invalid: "function f() { try { throw {a:2} } catch({...foo.a}) {} }". Produced the following syntax error: "SyntaxError: Unexpected token '.'. Expected a closing '}' following a rest element destructuring pattern."
Rest parameter
PASS Valid: "function foo(...a) { }"
PASS Valid: "function f() { function foo(...a) { } }"
PASS Valid: "function foo(a, ...b) { }"
PASS Valid: "function f() { function foo(a, ...b) { } }"
PASS Valid: "function foo(a = 20, ...b) { }"
PASS Valid: "function f() { function foo(a = 20, ...b) { } }"
PASS Valid: "function foo(a, b, c, d, e, f, g, ...h) { }"
PASS Valid: "function f() { function foo(a, b, c, d, e, f, g, ...h) { } }"
PASS Invalid: "function foo(a, ...b, c) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(a, ...b, c) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(a, ...b, ) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(a, ...b, ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(a, ...[b], ) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(a, ...[b], ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(a, ...{b}, ) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(a, ...{b}, ) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(a, ...a) { }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function f() { function foo(a, ...a) { } }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function foo(...a, ...b) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(...a, ...b) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(...b, ...b) { }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function f() { function foo(...b, ...b) { } }". Produced the following syntax error: "SyntaxError: Unexpected token ','. Rest parameter should be the last parameter in a function declaration."
PASS Invalid: "function foo(...b ...b) { }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function f() { function foo(...b ...b) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '...'. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function foo(a, a, ...b) { }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function f() { function foo(a, a, ...b) { } }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function foo(a, ...{b} = 20) { }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function f() { function foo(a, ...{b} = 20) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function foo(a, ...b = 20) { }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ')' or a ',' after a parameter declaration."
PASS Invalid: "function f() { function foo(a, ...b = 20) { } }". Produced the following syntax error: "SyntaxError: Unexpected token '='. Expected a ')' or a ',' after a parameter declaration."
PASS Valid: "function foo(...{b}) { }"
PASS Valid: "function f() { function foo(...{b}) { } }"
PASS Valid: "function foo(...[b]) { }"
PASS Valid: "function f() { function foo(...[b]) { } }"
PASS Invalid: "function foo(...123) { }". Produced the following syntax error: "SyntaxError: Unexpected number '123'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { function foo(...123) { } }". Produced the following syntax error: "SyntaxError: Unexpected number '123'. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function foo(...123abc) { }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Invalid: "function f() { function foo(...123abc) { } }". Produced the following syntax error: "SyntaxError: No identifiers allowed directly after numeric literal"
PASS Valid: "function foo(...abc123) { }"
PASS Valid: "function f() { function foo(...abc123) { } }"
PASS Valid: "function foo(...let) { }"
PASS Valid: "function f() { function foo(...let) { } }"
PASS Invalid: "'use strict'; function foo(...let) { }". Produced the following syntax error: "SyntaxError: Cannot use 'let' as a parameter name in strict mode."
PASS Invalid: "function f() { 'use strict'; function foo(...let) { } }". Produced the following syntax error: "SyntaxError: Cannot use 'let' as a parameter name in strict mode."
PASS Invalid: "'use strict'; function foo(...[let]) { }". Produced the following syntax error: "SyntaxError: Cannot use 'let' as a parameter name in strict mode."
PASS Invalid: "function f() { 'use strict'; function foo(...[let]) { } }". Produced the following syntax error: "SyntaxError: Cannot use 'let' as a parameter name in strict mode."
PASS Valid: "function foo(...yield) { }"
PASS Valid: "function f() { function foo(...yield) { } }"
PASS Invalid: "'use strict'; function foo(...yield) { }". Produced the following syntax error: "SyntaxError: Cannot use 'yield' as a parameter name in strict mode."
PASS Invalid: "function f() { 'use strict'; function foo(...yield) { } }". Produced the following syntax error: "SyntaxError: Cannot use 'yield' as a parameter name in strict mode."
PASS Invalid: "function foo(...if) { }". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'if' as a parameter name."
PASS Invalid: "function f() { function foo(...if) { } }". Produced the following syntax error: "SyntaxError: Cannot use the keyword 'if' as a parameter name."
PASS Valid: "let x = (...a) => { }"
PASS Valid: "function f() { let x = (...a) => { } }"
PASS Valid: "let x = (a, ...b) => { }"
PASS Valid: "function f() { let x = (a, ...b) => { } }"
PASS Valid: "let x = (a = 20, ...b) => { }"
PASS Valid: "function f() { let x = (a = 20, ...b) => { } }"
PASS Invalid: "let x = (a = 20, ...b, ...c) => { }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "function f() { let x = (a = 20, ...b, ...c) => { } }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Valid: "let x = (a = 20, ...[...b]) => { }"
PASS Valid: "function f() { let x = (a = 20, ...[...b]) => { } }"
PASS Valid: "let x = (a = 20, ...[...[b = 40]]) => { }"
PASS Valid: "function f() { let x = (a = 20, ...[...[b = 40]]) => { } }"
PASS Valid: "let x = (a = 20, ...{b}) => { }"
PASS Valid: "function f() { let x = (a = 20, ...{b}) => { } }"
PASS Valid: "let x = (a = 20, ...{...b}) => { }"
PASS Valid: "function f() { let x = (a = 20, ...{...b}) => { } }"
PASS Invalid: "let x = (a = 20, ...{124}) => { }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "function f() { let x = (a = 20, ...{124}) => { } }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
non-simple parameter list
PASS Invalid: "function foo(...restParam) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(...restParam) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(...restParam) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo({x}) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo({x}) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo({x}) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo({x}) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(a = 20) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(a = 20) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(a = 20) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(a = 20) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo({a} = 20) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo({a} = 20) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo({a} = 20) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo({a} = 20) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo([a]) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo([a]) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo([a]) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo([a]) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(foo, bar, a = 25) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(foo, bar, a = 25) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(foo, bar, a = 25) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(foo, bar, a = 25) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(foo, bar, baz, ...rest) { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(foo, bar, baz, ...rest) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(foo, bar, baz, ...rest) { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(foo, bar, baz, ...rest) { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(a = function() { }) { 'use strict'; a(); }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(a = function() { }) { 'use strict'; a(); } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function foo(a = function() { }) { 'a'; 'use strict'; a(); }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function foo(a = function() { }) { 'a'; 'use strict'; a(); } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (...restParam) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (...restParam) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (...restParam) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (...restParam) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ({x}) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ({x}) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ({x}) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ({x}) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (a = 20) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (a = 20) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (a = 20) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (a = 20) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ({a} = 20) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ({a} = 20) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ({a} = 20) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ({a} = 20) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ([a]) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ([a]) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = ([a]) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = ([a]) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (foo, bar, a = 25) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (foo, bar, a = 25) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (foo, bar, a = 25) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (foo, bar, a = 25) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (foo, bar, baz, ...rest) => { 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (foo, bar, baz, ...rest) => { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (foo, bar, baz, ...rest) => { 'a'; 'use strict'; }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (foo, bar, baz, ...rest) => { 'a'; 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (a = function() { }) => { 'use strict'; a(); }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (a = function() { }) => { 'use strict'; a(); } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "let foo = (a = function() { }) => { 'a'; 'use strict'; a(); }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { let foo = (a = function() { }) => { 'a'; 'use strict'; a(); } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Valid: "function outer() { 'use strict'; function foo(...restParam) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(...restParam) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a,b,c,...restParam) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a,b,c,...restParam) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a = 20,b,c,...restParam) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a = 20,b,c,...restParam) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a = 20,{b},c,...restParam) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a = 20,{b},c,...restParam) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a = 20,{b},[c] = 5,...restParam) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a = 20,{b},[c] = 5,...restParam) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a = 20) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a = 20) { } } }"
PASS Valid: "function outer() { 'use strict'; function foo(a,b,c,{d} = 20) { } }"
PASS Valid: "function f() { function outer() { 'use strict'; function foo(a,b,c,{d} = 20) { } } }"
PASS Invalid: "function outer() { 'use strict'; function foo(...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(...restParam) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a,b,c,...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a,b,c,...restParam) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a = 20,b,c,...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a = 20,b,c,...restParam) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a = 20,{b},c,...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a = 20,{b},c,...restParam) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a = 20,{b},[c] = 5,...restParam) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a = 20,{b},[c] = 5,...restParam) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a = 20) { 'use strict';} }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a = 20) { 'use strict';} } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function outer() { 'use strict'; function foo(a,b,c,{d} = 20) { 'use strict'; } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
PASS Invalid: "function f() { function outer() { 'use strict'; function foo(a,b,c,{d} = 20) { 'use strict'; } } }". Produced the following syntax error: "SyntaxError: 'use strict' directive not allowed inside a function with a non-simple parameter list."
Arrow function
PASS Valid: "var x = (x) => x;"
PASS Valid: "function f() { var x = (x) => x; }"
PASS Valid: "var x = (x, y, z) => x;"
PASS Valid: "function f() { var x = (x, y, z) => x; }"
PASS Valid: "var x = ({x}, [y], z) => x;"
PASS Valid: "function f() { var x = ({x}, [y], z) => x; }"
PASS Valid: "var x = ({x = 30}, [y], z) => x;"
PASS Valid: "function f() { var x = ({x = 30}, [y], z) => x; }"
PASS Valid: "var x = (x = 20) => x;"
PASS Valid: "function f() { var x = (x = 20) => x; }"
PASS Valid: "var x = ([x] = 20, y) => x;"
PASS Valid: "function f() { var x = ([x] = 20, y) => x; }"
PASS Valid: "var x = ([x = 20] = 20) => x;"
PASS Valid: "function f() { var x = ([x = 20] = 20) => x; }"
PASS Valid: "var x = foo => x;"
PASS Valid: "function f() { var x = foo => x; }"
PASS Valid: "var x = foo => x => x => x => x;"
PASS Valid: "function f() { var x = foo => x => x => x => x; }"
PASS Valid: "var x = foo => x => (x = 20) => (x = 20) => x;"
PASS Valid: "function f() { var x = foo => x => (x = 20) => (x = 20) => x; }"
PASS Valid: "var x = foo => x => x => x => {x};"
PASS Valid: "function f() { var x = foo => x => x => x => {x}; }"
PASS Valid: "var x = ([x = 25]) => x => x => ({x} = {});"
PASS Valid: "function f() { var x = ([x = 25]) => x => x => ({x} = {}); }"
PASS Invalid: "var x = foo => x => x => {x} => x;". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var x = foo => x => x => {x} => x; }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "var x = {x} = 20 => x;". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var x = {x} = 20 => x; }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "var x = [x] = 20 => x;". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var x = [x] = 20 => x; }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "var x = [x = 25] = 20 => x;". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "function f() { var x = [x = 25] = 20 => x; }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ';' after variable declaration."
PASS Invalid: "var x = ([x = 25]) =>;". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "function f() { var x = ([x = 25]) =>; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "var x = ([x = 25]) => x =>;". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "function f() { var x = ([x = 25]) => x =>; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "var x = ([x = 25]) => x => x =>;". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "function f() { var x = ([x = 25]) => x => x =>; }". Produced the following syntax error: "SyntaxError: Unexpected token ';'"
PASS Invalid: "var x = ([x = 25]) => x => x => {;". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "function f() { var x = ([x = 25]) => x => x => {; }". Produced the following syntax error: "SyntaxError: Unexpected end of script"
PASS Invalid: "var x ==> x;". Produced the following syntax error: "SyntaxError: Unexpected token '=='. Expected ';' after variable declaration."
PASS Invalid: "function f() { var x ==> x; }". Produced the following syntax error: "SyntaxError: Unexpected token '=='. Expected ';' after variable declaration."
PASS Invalid: "var x = x ==> x;". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Invalid: "function f() { var x = x ==> x; }". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Valid: "foo((x) => x)" with ReferenceError
PASS Valid: "function f() { foo((x) => x) }"
PASS Valid: "foo((x, y, z) => x)" with ReferenceError
PASS Valid: "function f() { foo((x, y, z) => x) }"
PASS Valid: "foo(({x}, [y], z) => x)" with ReferenceError
PASS Valid: "function f() { foo(({x}, [y], z) => x) }"
PASS Valid: "foo(({x = 30}, [y], z) => x)" with ReferenceError
PASS Valid: "function f() { foo(({x = 30}, [y], z) => x) }"
PASS Valid: "foo((x = 20) => x)" with ReferenceError
PASS Valid: "function f() { foo((x = 20) => x) }"
PASS Valid: "foo(([x] = 20, y) => x)" with ReferenceError
PASS Valid: "function f() { foo(([x] = 20, y) => x) }"
PASS Valid: "foo(([x = 20] = 20) => x)" with ReferenceError
PASS Valid: "function f() { foo(([x = 20] = 20) => x) }"
PASS Valid: "foo(foo => x)" with ReferenceError
PASS Valid: "function f() { foo(foo => x) }"
PASS Valid: "foo(foo => x => x => x => x)" with ReferenceError
PASS Valid: "function f() { foo(foo => x => x => x => x) }"
PASS Valid: "foo(foo => x => (x = 20) => (x = 20) => x)" with ReferenceError
PASS Valid: "function f() { foo(foo => x => (x = 20) => (x = 20) => x) }"
PASS Valid: "foo(foo => x => x => x => {x})" with ReferenceError
PASS Valid: "function f() { foo(foo => x => x => x => {x}) }"
PASS Valid: "foo(([x = 25]) => x => x => ({x} = {}))" with ReferenceError
PASS Valid: "function f() { foo(([x = 25]) => x => x => ({x} = {})) }"
PASS Invalid: "foo(foo => x => x => {x} => x)". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "function f() { foo(foo => x => x => {x} => x) }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "foo({x} = 20 => x)". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "function f() { foo({x} = 20 => x) }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "foo([x] = 20 => x)". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "function f() { foo([x] = 20 => x) }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "foo([x = 25] = 20 => x)". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "function f() { foo([x = 25] = 20 => x) }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ')' to end an argument list."
PASS Invalid: "foo(([x = 25]) =>)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { foo(([x = 25]) =>) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "foo(([x = 25]) => x =>)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { foo(([x = 25]) => x =>) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "foo(([x = 25]) => x => x =>)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { foo(([x = 25]) => x => x =>) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "foo(([x = 25]) => x => x => {)". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "function f() { foo(([x = 25]) => x => x => {) }". Produced the following syntax error: "SyntaxError: Unexpected token ')'"
PASS Invalid: "foo(x ==> x)". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Invalid: "function f() { foo(x ==> x) }". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Invalid: "foo(x = x ==> x)". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Invalid: "function f() { foo(x = x ==> x) }". Produced the following syntax error: "SyntaxError: Unexpected token '>'"
PASS Valid: "var f = cond ? ()=>20 : ()=>20" with ReferenceError
PASS Valid: "function f() { var f = cond ? ()=>20 : ()=>20 }"
PASS Valid: "var f = cond ? (x)=>{x} : ()=>20" with ReferenceError
PASS Valid: "function f() { var f = cond ? (x)=>{x} : ()=>20 }"
PASS Valid: "var f = cond ? (x)=>x : ()=>{2}" with ReferenceError
PASS Valid: "function f() { var f = cond ? (x)=>x : ()=>{2} }"
PASS Valid: "var f = cond ? (x)=>x : x=>2" with ReferenceError
PASS Valid: "function f() { var f = cond ? (x)=>x : x=>2 }"
PASS Valid: "var f = cond ? x=>x : x=>2" with ReferenceError
PASS Valid: "function f() { var f = cond ? x=>x : x=>2 }"
PASS Valid: "var f = cond ? x=>x*2 : x=>2" with ReferenceError
PASS Valid: "function f() { var f = cond ? x=>x*2 : x=>2 }"
PASS Valid: "var f = cond ? x=>x.foo : x=>2" with ReferenceError
PASS Valid: "function f() { var f = cond ? x=>x.foo : x=>2 }"
PASS Valid: "var f = cond ? x=>x.foo : x=>x + x + x + x + x + x + x" with ReferenceError
PASS Valid: "function f() { var f = cond ? x=>x.foo : x=>x + x + x + x + x + x + x }"
PASS Valid: "var f = cond ? x=>{x.foo } : x=>x + x + x + x + x + x + (x =>x) " with ReferenceError
PASS Valid: "function f() { var f = cond ? x=>{x.foo } : x=>x + x + x + x + x + x + (x =>x) }"
PASS Valid: "var f = (x) => x => (x) => ({y}) => y"
PASS Valid: "function f() { var f = (x) => x => (x) => ({y}) => y }"
PASS Invalid: "var f = cond ? x=>x.foo; : x=>x + x + x + x + x + x + x". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Expected ':' in ternary operator."
PASS Invalid: "function f() { var f = cond ? x=>x.foo; : x=>x + x + x + x + x + x + x }". Produced the following syntax error: "SyntaxError: Unexpected token ';'. Expected ':' in ternary operator."
PASS Invalid: "var f = cond ? x=>x.foo : : x=>x + x + x + x + x + x + x". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Invalid: "function f() { var f = cond ? x=>x.foo : : x=>x + x + x + x + x + x + x }". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Invalid: "var f = cond ? x=>{x.foo :} : x=>x + x + x + x + x + x + x". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Invalid: "function f() { var f = cond ? x=>{x.foo :} : x=>x + x + x + x + x + x + x }". Produced the following syntax error: "SyntaxError: Unexpected token ':'"
PASS Invalid: "var f = cond ? x=>{x.foo } => : x=>x + x + x + x + x + x + x". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ':' in ternary operator."
PASS Invalid: "function f() { var f = cond ? x=>{x.foo } => : x=>x + x + x + x + x + x + x }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'. Expected ':' in ternary operator."
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => super.foo) { return y(); } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => super.foo) { return y(); } } }"
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => {return super.foo}) { return y(); } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => {return super.foo}) { return y(); } } }"
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => {return () => super.foo}) { return y()(); } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = () => {return () => super.foo}) { return y()(); } } }"
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = (y = () => super.foo) => {return y()}) { return y(); } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { x(y = (y = () => super.foo) => {return y()}) { return y(); } } }"
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () => super.foo) { super(); this._x_f = x; } x() { return this._x_f(); } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () => super.foo) { super(); this._x_f = x; } x() { return this._x_f(); } } }"
PASS Valid: "class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () => super()) { x(); } x() { return super.foo; } }"
PASS Valid: "function f() { class C { constructor() { this._x = 45; } get foo() { return this._x;} } class D extends C { constructor(x = () => super()) { x(); } x() { return super.foo; } } }"
PASS Invalid: "let x = (a,a)=>a;". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "function f() { let x = (a,a)=>a; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "let x = ([a],a)=>a;". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = ([a],a)=>a; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = ([a, a])=>a;". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = ([a, a])=>a; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = ({a, b:{a}})=>a;". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = ({a, b:{a}})=>a; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = (a,a)=>{ a };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "function f() { let x = (a,a)=>{ a }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "let x = ([a],a)=>{ };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = ([a],a)=>{ }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = ([a, a])=>{ };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = ([a, a])=>{ }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = (a, ...a)=>{ };". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "function f() { let x = (a, ...a)=>{ }; }". Produced the following syntax error: "SyntaxError: Unexpected token '...'"
PASS Invalid: "let x = (b, c, b)=>{ };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in an arrow function."
PASS Invalid: "function f() { let x = (b, c, b)=>{ }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in an arrow function."
PASS Invalid: "let x = (a, b, c, d, {a})=>{ };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { let x = (a, b, c, d, {a})=>{ }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "let x = (b = (a,a)=>a, b)=>{ };". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "function f() { let x = (b = (a,a)=>a, b)=>{ }; }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in an arrow function."
PASS Invalid: "((a,a)=>a);". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "function f() { ((a,a)=>a); }". Produced the following syntax error: "SyntaxError: Unexpected token '('. Expected a parameter pattern or a ')' in parameter list."
PASS Invalid: "let x = (a)
=>a;". Produced the following syntax error: "SyntaxError: Unexpected token '=>'"
PASS Invalid: "function f() { let x = (a)
=>a; }". Produced the following syntax error: "SyntaxError: Unexpected token '=>'"
PASS Invalid: "({ foo(a,a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "function f() { ({ foo(a,a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "({ foo(b, c, b){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Invalid: "function f() { ({ foo(b, c, b){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Invalid: "({ *foo(a,a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "function f() { ({ *foo(a,a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "({ *foo(b, c, b){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Invalid: "function f() { ({ *foo(b, c, b){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Invalid: "({ async foo(a,a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "function f() { ({ async foo(a,a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in a method."
PASS Invalid: "({ async foo(b, c, b){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Invalid: "function f() { ({ async foo(b, c, b){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'b' not allowed in a method."
PASS Valid: "({ foo: function(a,a){} });"
PASS Valid: "function f() { ({ foo: function(a,a){} }); }"
PASS Valid: "({ foo: function(b, c, b){} });"
PASS Valid: "function f() { ({ foo: function(b, c, b){} }); }"
PASS Valid: "({ foo: function*(a,a){} });"
PASS Valid: "function f() { ({ foo: function*(a,a){} }); }"
PASS Valid: "({ foo: function*(b, c, b){} });"
PASS Valid: "function f() { ({ foo: function*(b, c, b){} }); }"
PASS Valid: "({ foo: async function(a,a){} });"
PASS Valid: "function f() { ({ foo: async function(a,a){} }); }"
PASS Valid: "({ foo: async function(b, c, b){} });"
PASS Valid: "function f() { ({ foo: async function(b, c, b){} }); }"
PASS Invalid: "({ foo({a},a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ foo({a},a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ foo(a,{a}){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ foo(a,{a}){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ foo(a,...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function f() { ({ foo(a,...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "({ foo({a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ foo({a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ foo({...a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ foo({...a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ *foo({a},a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ *foo({a},a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ *foo(a,{a}){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ *foo(a,{a}){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ *foo(a,...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function f() { ({ *foo(a,...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "({ *foo({a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ *foo({a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ *foo({...a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ *foo({...a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ async foo({a},a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ async foo({a},a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ async foo(a,{a}){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ async foo(a,{a}){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ async foo(a,...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "function f() { ({ async foo(a,...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with a rest parameter."
PASS Invalid: "({ async foo({a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ async foo({a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "({ async foo({...a},...a){} });". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Invalid: "function f() { ({ async foo({...a},...a){} }); }". Produced the following syntax error: "SyntaxError: Duplicate parameter 'a' not allowed in function with destructuring parameters."
PASS Valid: "({ foo(a, ...b){} });"
PASS Valid: "function f() { ({ foo(a, ...b){} }); }"
PASS Valid: "({ foo({a}, ...b){} });"
PASS Valid: "function f() { ({ foo({a}, ...b){} }); }"
PASS Valid: "({ foo({a, ...b}){} });"
PASS Valid: "function f() { ({ foo({a, ...b}){} }); }"
PASS Valid: "({ foo({b, ...a}, ...c){} });"
PASS Valid: "function f() { ({ foo({b, ...a}, ...c){} }); }"
Weird things that used to crash.
PASS Invalid: "or ([[{break //(elseifo (a=0;a<2;a++)n=
[[{aFYY sga=
[[{a=Yth FunctionRY&=Ylet 'a'}V a". Produced the following syntax error: "SyntaxError: Unexpected token '//'. Expected a ':' following the property name 'break'."
PASS Invalid: "function f() { or ([[{break //(elseifo (a=0;a<2;a++)n=
[[{aFYY sga=
[[{a=Yth FunctionRY&=Ylet 'a'}V a }". Produced the following syntax error: "SyntaxError: Unexpected token '//'. Expected a ':' following the property name 'break'."
PASS e.line is 1
PASS foo is 'PASS'
PASS bar is 'PASS'
PASS successfullyParsed is true
TEST COMPLETE