Skip to content
Snippets Groups Projects
Commit 021ed85d authored by Mike Pennisi's avatar Mike Pennisi
Browse files

Add syntax tests for declaration restrictions

Assert that declarations are not permitted in positions reserved for
statements only.
parent 007d3b1e
No related branches found
No related tags found
No related merge requests found
Showing
with 200 additions and 0 deletions
// 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)
// 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)
// 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)
// 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)
// 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)
// 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 {}
// 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;
// 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() {}
// 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() {}
// 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;
// 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 {}
// 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;
// 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() {}
// 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() {}
// 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;
// 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 {}
// 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;
// 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() {}
// 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() {}
// 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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment