diff --git a/test/language/statements/do-while/decl-cls.js b/test/language/statements/do-while/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..b88a399b8ba855454d066e4dfdb0111d0abcb3bc --- /dev/null +++ b/test/language/statements/do-while/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-do-while-statement +es6id: 13.7.2 +negative: SyntaxError +---*/ + +do class C {} while (false) diff --git a/test/language/statements/do-while/decl-const.js b/test/language/statements/do-while/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..6e8a23a70f1b022e8e1ab830fe80d98ef47e2c94 --- /dev/null +++ b/test/language/statements/do-while/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-do-while-statement +es6id: 13.7.2 +negative: SyntaxError +---*/ + +do const x = null; while (false) diff --git a/test/language/statements/do-while/decl-fun.js b/test/language/statements/do-while/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..ff94a75480aa77ac6d8ae820d278cfacaf5c9710 --- /dev/null +++ b/test/language/statements/do-while/decl-fun.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-do-while-statement +es6id: 13.7.2 +negative: SyntaxError +---*/ + +do function f() {} while (false) diff --git a/test/language/statements/do-while/decl-gen.js b/test/language/statements/do-while/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..2e47fcc5fd97b15c20291df71e918e725d177227 --- /dev/null +++ b/test/language/statements/do-while/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-do-while-statement +es6id: 13.7.2 +negative: SyntaxError +---*/ + +do function* g() {} while (false) diff --git a/test/language/statements/do-while/decl-let.js b/test/language/statements/do-while/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..42c320ea45c3b9d52757e429f929d36278909d59 --- /dev/null +++ b/test/language/statements/do-while/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-do-while-statement +es6id: 13.7.2 +negative: SyntaxError +---*/ + +do let x; while (false) diff --git a/test/language/statements/for-in/decl-cls.js b/test/language/statements/for-in/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..85ff5e16a30590568db239367904a6c6572bc1fd --- /dev/null +++ b/test/language/statements/for-in/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x in {}) class C {} diff --git a/test/language/statements/for-in/decl-const.js b/test/language/statements/for-in/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..3a55cd477d68e98fa55da8f2d4659cb22f2d81d6 --- /dev/null +++ b/test/language/statements/for-in/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x in {}) const y = null; diff --git a/test/language/statements/for-in/decl-fun.js b/test/language/statements/for-in/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..29509bc4135c7551f26d949b32a16d85f237120f --- /dev/null +++ b/test/language/statements/for-in/decl-fun.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x in {}) function f() {} diff --git a/test/language/statements/for-in/decl-gen.js b/test/language/statements/for-in/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..4d263ec376e9ef0c3eb751a439b1ff5a62388ef2 --- /dev/null +++ b/test/language/statements/for-in/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x in {}) function* g() {} diff --git a/test/language/statements/for-in/decl-let.js b/test/language/statements/for-in/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..2cf556476d6e1d5ffbd875807617c87a05880e62 --- /dev/null +++ b/test/language/statements/for-in/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x in {}) let y; diff --git a/test/language/statements/for-of/decl-cls.js b/test/language/statements/for-of/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..d33b4eb58e7648b21f00dd7f01672f2bdf9954f1 --- /dev/null +++ b/test/language/statements/for-of/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x of []) class C {} diff --git a/test/language/statements/for-of/decl-const.js b/test/language/statements/for-of/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..69d193185bff0e2386931602f219248652ef2d4b --- /dev/null +++ b/test/language/statements/for-of/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x of []) const y = null; diff --git a/test/language/statements/for-of/decl-fun.js b/test/language/statements/for-of/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..8001c192e9ddaad8751dc929011e6b5043e96b75 --- /dev/null +++ b/test/language/statements/for-of/decl-fun.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x of []) function f() {} diff --git a/test/language/statements/for-of/decl-gen.js b/test/language/statements/for-of/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..eb4b3aab1f3a3b9838466decdde38cbdb6ddba96 --- /dev/null +++ b/test/language/statements/for-of/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x of []) function* g() {} diff --git a/test/language/statements/for-of/decl-let.js b/test/language/statements/for-of/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..93cd0725def8785f2a0ba74675ef7d5fdbb2a020 --- /dev/null +++ b/test/language/statements/for-of/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-for-in-and-for-of-statements +es6id: 13.7.5 +negative: SyntaxError +---*/ + +for (var x of []) let y; diff --git a/test/language/statements/for/decl-cls.js b/test/language/statements/for/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..54a6ffbc500469d2dac9c21bbc5d0e69c8d89ebf --- /dev/null +++ b/test/language/statements/for/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-for-statement +es6id: 13.7.4 +negative: SyntaxError +---*/ + +for ( ; false; ) class C {} diff --git a/test/language/statements/for/decl-const.js b/test/language/statements/for/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..0c54e877416fdc4c72ac71f41bf63803ac00b9b5 --- /dev/null +++ b/test/language/statements/for/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-for-statement +es6id: 13.7.4 +negative: SyntaxError +---*/ + +for ( ; false; ) const x = null; diff --git a/test/language/statements/for/decl-fun.js b/test/language/statements/for/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..ef3005a5c0b34bdc8ba8780e893faaffcb61864a --- /dev/null +++ b/test/language/statements/for/decl-fun.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-for-statement +es6id: 13.7.4 +negative: SyntaxError +---*/ + +for ( ; false; ) function f() {} diff --git a/test/language/statements/for/decl-gen.js b/test/language/statements/for/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..30a02fa163e92e0fbb345c97579bdca6c118d458 --- /dev/null +++ b/test/language/statements/for/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-for-statement +es6id: 13.7.4 +negative: SyntaxError +---*/ + +for ( ; false; ) function* g() {} diff --git a/test/language/statements/for/decl-let.js b/test/language/statements/for/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..9b40c281d4ea001d0975d0b62b0ccd2c49c100be --- /dev/null +++ b/test/language/statements/for/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-for-statement +es6id: 13.7.4 +negative: SyntaxError +---*/ + +for ( ; false; ) let x; diff --git a/test/language/statements/if/if-cls-else-cls.js b/test/language/statements/if/if-cls-else-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..16e6728367cf0250db0b62c837cc8f184384ea40 --- /dev/null +++ b/test/language/statements/if/if-cls-else-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) class C {} else class D {} diff --git a/test/language/statements/if/if-cls-else-stmt.js b/test/language/statements/if/if-cls-else-stmt.js new file mode 100644 index 0000000000000000000000000000000000000000..1c5fdca986e01c55a6e3c6880133e487e503fd20 --- /dev/null +++ b/test/language/statements/if/if-cls-else-stmt.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) class C {} else ; diff --git a/test/language/statements/if/if-cls-no-else.js b/test/language/statements/if/if-cls-no-else.js new file mode 100644 index 0000000000000000000000000000000000000000..49956bf38c65dd22a5e095f47425a0a9fccc0da8 --- /dev/null +++ b/test/language/statements/if/if-cls-no-else.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) class C {} diff --git a/test/language/statements/if/if-const-else-const.js b/test/language/statements/if/if-const-else-const.js new file mode 100644 index 0000000000000000000000000000000000000000..fba8cdbadfc9dd503a895a20cfad9f794102082f --- /dev/null +++ b/test/language/statements/if/if-const-else-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) const x = null; else const y = null; diff --git a/test/language/statements/if/if-const-else-stmt.js b/test/language/statements/if/if-const-else-stmt.js new file mode 100644 index 0000000000000000000000000000000000000000..e051c1726c1b78d990ea83146db82d648e0821ee --- /dev/null +++ b/test/language/statements/if/if-const-else-stmt.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) const x = null; else ; diff --git a/test/language/statements/if/if-const-no-else.js b/test/language/statements/if/if-const-no-else.js new file mode 100644 index 0000000000000000000000000000000000000000..317751f4e4b16cd8dd0a1bfb2a04facfda907b96 --- /dev/null +++ b/test/language/statements/if/if-const-no-else.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) const x = null; diff --git a/test/language/statements/if/if-fun-else-fun-strict.js b/test/language/statements/if/if-fun-else-fun-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..f6f58378744f23b071d1b17bd72ac9f08cfd7ab5 --- /dev/null +++ b/test/language/statements/if/if-fun-else-fun-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode (IfStatement with a declaration in both statement positions in the global scope) +esid: sec-if-statement +es6id: 13.6 +flags: [onlyStrict] +negative: SyntaxError +info: > + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + The above rules are only applied when parsing code that is not strict mode code. +---*/ + +if (true) function f() {} else function _f() {} diff --git a/test/language/statements/if/if-fun-else-stmt-strict.js b/test/language/statements/if/if-fun-else-stmt-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..fcb8da8deb1a52eccd4e825e85c9b048ef72ebf4 --- /dev/null +++ b/test/language/statements/if/if-fun-else-stmt-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the first statement position in the global scope) +esid: sec-if-statement +es6id: 13.6 +flags: [onlyStrict] +negative: SyntaxError +info: > + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + The above rules are only applied when parsing code that is not strict mode code. +---*/ + +if (true) function f() {} else ; diff --git a/test/language/statements/if/if-fun-no-else-strict.js b/test/language/statements/if/if-fun-no-else-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..7e1199e363d84f4425bcf273ca260f81ceb053ce --- /dev/null +++ b/test/language/statements/if/if-fun-no-else-strict.js @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode (IfStatement without an else clause in the global scope) +esid: sec-if-statement +es6id: 13.6 +flags: [onlyStrict] +negative: SyntaxError +info: > + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + The above rules are only applied when parsing code that is not strict mode code. +---*/ + +if (true) function f() {} diff --git a/test/language/statements/if/if-gen-else-gen.js b/test/language/statements/if/if-gen-else-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..438b1e2cb605878db3b0a21ef5024d0069ee70c9 --- /dev/null +++ b/test/language/statements/if/if-gen-else-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) function* g() { } else function* _g() {} diff --git a/test/language/statements/if/if-gen-else-stmt.js b/test/language/statements/if/if-gen-else-stmt.js new file mode 100644 index 0000000000000000000000000000000000000000..a39b393374c3ad42e8b40e959e1e6782728889a3 --- /dev/null +++ b/test/language/statements/if/if-gen-else-stmt.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) function* g() { } else ; diff --git a/test/language/statements/if/if-gen-no-else.js b/test/language/statements/if/if-gen-no-else.js new file mode 100644 index 0000000000000000000000000000000000000000..5a90a93a5a19621e96aa42aa042e0a3e79a3a0ae --- /dev/null +++ b/test/language/statements/if/if-gen-no-else.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) function* g() { } diff --git a/test/language/statements/if/if-let-else-let.js b/test/language/statements/if/if-let-else-let.js new file mode 100644 index 0000000000000000000000000000000000000000..499132770491f965a259f09ac3f0726d851e79ab --- /dev/null +++ b/test/language/statements/if/if-let-else-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) let x; else let y; diff --git a/test/language/statements/if/if-let-else-stmt.js b/test/language/statements/if/if-let-else-stmt.js new file mode 100644 index 0000000000000000000000000000000000000000..065476cb9b0fa9ea661a6783a16473cbaa81c1fe --- /dev/null +++ b/test/language/statements/if/if-let-else-stmt.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) let x; else ; diff --git a/test/language/statements/if/if-let-no-else.js b/test/language/statements/if/if-let-no-else.js new file mode 100644 index 0000000000000000000000000000000000000000..c24f675ea284b247d8003a63c62b503436a847ee --- /dev/null +++ b/test/language/statements/if/if-let-no-else.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (true) let x; diff --git a/test/language/statements/if/if-stmt-else-cls.js b/test/language/statements/if/if-stmt-else-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..2d05e58d8a0daf4250fbf6dd05860a5ae8d20898 --- /dev/null +++ b/test/language/statements/if/if-stmt-else-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (false) ; else class C {} diff --git a/test/language/statements/if/if-stmt-else-const.js b/test/language/statements/if/if-stmt-else-const.js new file mode 100644 index 0000000000000000000000000000000000000000..e8746d34dbb9311e000dc0b2b2966743a82be268 --- /dev/null +++ b/test/language/statements/if/if-stmt-else-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (false) ; else const x = null; diff --git a/test/language/statements/if/if-stmt-else-fun-strict.js b/test/language/statements/if/if-stmt-else-fun-strict.js new file mode 100644 index 0000000000000000000000000000000000000000..80326edf3ecbc088753783791aa469f2edacbade --- /dev/null +++ b/test/language/statements/if/if-stmt-else-fun-strict.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: AnnexB extension not honored in strict mode (IfStatement with a declaration in the second statement position in the global scope) +esid: sec-if-statement +es6id: 13.6 +flags: [onlyStrict] +negative: SyntaxError +info: > + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + B.3.3.2 Changes to GlobalDeclarationInstantiation + + 1. 1. Let strict be IsStrict of script + 2. If strict is *false*, then + [...] +---*/ + +if (false) ; else function f() {} diff --git a/test/language/statements/if/if-stmt-else-gen.js b/test/language/statements/if/if-stmt-else-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..d5a158e294b91779918c3213013f51c820042f08 --- /dev/null +++ b/test/language/statements/if/if-stmt-else-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (false) ; else function* g() { } diff --git a/test/language/statements/if/if-stmt-else-let.js b/test/language/statements/if/if-stmt-else-let.js new file mode 100644 index 0000000000000000000000000000000000000000..28cd5a74acb067282e997d98ca3af31949a4d2a8 --- /dev/null +++ b/test/language/statements/if/if-stmt-else-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-if-statement +es6id: 13.6 +negative: SyntaxError +---*/ + +if (false) ; else let x; diff --git a/test/language/statements/labeled/decl-cls.js b/test/language/statements/labeled/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..5b94766564b7a0ba1298bcb40510a2c465221df2 --- /dev/null +++ b/test/language/statements/labeled/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-labelled-statements +es6id: 13.13 +negative: SyntaxError +---*/ + +label: class C {} diff --git a/test/language/statements/labeled/decl-const.js b/test/language/statements/labeled/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..0cbc8f8693aa86491ca16ea65a12af063a586bdd --- /dev/null +++ b/test/language/statements/labeled/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-labelled-statements +es6id: 13.13 +negative: SyntaxError +---*/ + +label: const x = null; diff --git a/test/language/statements/labeled/labelled-function-declaration-strict.js b/test/language/statements/labeled/decl-fun-strict.js similarity index 88% rename from test/language/statements/labeled/labelled-function-declaration-strict.js rename to test/language/statements/labeled/decl-fun-strict.js index 9f6fa35e41419fee9eaf032b68c4e4cc2828f48f..edbf6a3d0d23e02493a73221aa467c5b8277b4ee 100644 --- a/test/language/statements/labeled/labelled-function-declaration-strict.js +++ b/test/language/statements/labeled/decl-fun-strict.js @@ -1,12 +1,13 @@ // Copyright (C) 2011 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -es6id: 13.1 +esid: sec-labelled-statements +es6id: 13.13 description: > function declarations in statement position in strict mode: label: Statement flags: [onlyStrict] negative: SyntaxError ---*/ -label: function g() {} +label: function g() {} diff --git a/test/language/statements/labeled/decl-gen.js b/test/language/statements/labeled/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..7ba25d863e9cdfc4a198ba93bf0f94d417ac1cbe --- /dev/null +++ b/test/language/statements/labeled/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-labelled-statements +es6id: 13.13 +negative: SyntaxError +---*/ + +label: function* g() {} diff --git a/test/language/statements/labeled/decl-let.js b/test/language/statements/labeled/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..8d5d9e5d5df1f2db56acd5894e770b15fdeb71b9 --- /dev/null +++ b/test/language/statements/labeled/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-labelled-statements +es6id: 13.13 +negative: SyntaxError +---*/ + +label: let x; diff --git a/test/language/statements/while/decl-cls.js b/test/language/statements/while/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..f2c30d1e6333d30be4b6b6c7c50ba5a1cd69ad28 --- /dev/null +++ b/test/language/statements/while/decl-cls.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-while-statement +es6id: 13.7.3 +negative: SyntaxError +---*/ + +while (false) class C {} diff --git a/test/language/statements/while/decl-const.js b/test/language/statements/while/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..93b313f3ce04cf419b70dda384219032aeeea8c3 --- /dev/null +++ b/test/language/statements/while/decl-const.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-while-statement +es6id: 13.7.3 +negative: SyntaxError +---*/ + +while (false) const x = null; diff --git a/test/language/statements/while/decl-fun.js b/test/language/statements/while/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..e76d8c893f2e16960f54dad6711aadd88d833bea --- /dev/null +++ b/test/language/statements/while/decl-fun.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-while-statement +es6id: 13.7.3 +negative: SyntaxError +---*/ + +while (false) function f() {} diff --git a/test/language/statements/while/decl-gen.js b/test/language/statements/while/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..62973f4581df579b550052b9cfd9681d15cc85d1 --- /dev/null +++ b/test/language/statements/while/decl-gen.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-while-statement +es6id: 13.7.3 +negative: SyntaxError +---*/ + +while (false) function* g() {} diff --git a/test/language/statements/while/decl-let.js b/test/language/statements/while/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..920673f56c822964c5ffb966a31cac716e3cae14 --- /dev/null +++ b/test/language/statements/while/decl-let.js @@ -0,0 +1,10 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-while-statement +es6id: 13.7.3 +negative: SyntaxError +---*/ + +while (false) let x; diff --git a/test/language/statements/with/decl-cls.js b/test/language/statements/with/decl-cls.js new file mode 100644 index 0000000000000000000000000000000000000000..18f1f9ab5f9d17fccfdb0015b73036340335d611 --- /dev/null +++ b/test/language/statements/with/decl-cls.js @@ -0,0 +1,11 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Class declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: SyntaxError +---*/ + +with ({}) class C {} diff --git a/test/language/statements/with/decl-const.js b/test/language/statements/with/decl-const.js new file mode 100644 index 0000000000000000000000000000000000000000..d5e5b8aeb1ac4785defbb2a1dfc7ca53ebe456c7 --- /dev/null +++ b/test/language/statements/with/decl-const.js @@ -0,0 +1,11 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (const) not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: SyntaxError +---*/ + +with ({}) const x = null; diff --git a/test/language/statements/with/decl-fun.js b/test/language/statements/with/decl-fun.js new file mode 100644 index 0000000000000000000000000000000000000000..3bed84ea2d36d58e98024eb0d8ef91a1dcd38654 --- /dev/null +++ b/test/language/statements/with/decl-fun.js @@ -0,0 +1,11 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Function declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: SyntaxError +---*/ + +with ({}) function f() {} diff --git a/test/language/statements/with/decl-gen.js b/test/language/statements/with/decl-gen.js new file mode 100644 index 0000000000000000000000000000000000000000..0d0c2451e2750876b52a82221f78d6606432c119 --- /dev/null +++ b/test/language/statements/with/decl-gen.js @@ -0,0 +1,11 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Generator declaration not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: SyntaxError +---*/ + +with ({}) function* g() {} diff --git a/test/language/statements/with/decl-let.js b/test/language/statements/with/decl-let.js new file mode 100644 index 0000000000000000000000000000000000000000..9293c0aa564f1c7a90d4c71a17e8ef0cfc8884c5 --- /dev/null +++ b/test/language/statements/with/decl-let.js @@ -0,0 +1,11 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Lexical declaration (let) not allowed in statement position +esid: sec-with-statement +es6id: 13.11 +flags: [noStrict] +negative: SyntaxError +---*/ + +with ({}) let x;