diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/block-scope | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/block-scope')
163 files changed, 3551 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/block-scope/browser.js b/js/src/tests/test262/language/block-scope/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/browser.js diff --git a/js/src/tests/test262/language/block-scope/leave/browser.js b/js/src/tests/test262/language/block-scope/leave/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/browser.js diff --git a/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..71df11fcf4 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,20 @@ +// 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 +description: > + finally block let declaration only shadows outer parameter value 1 +---*/ +try { + (function(x) { + try { + let x = 'inner'; + throw 0; + } finally { + assert.sameValue(x, 'outer'); + } + })('outer'); +} catch (e) {} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..39ddaaca24 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,23 @@ +// 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 +description: > + finally block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + try { + let x = 'middle'; + { + let x = 'inner'; + throw 0; + } + } catch(e) { + + } finally { + assert.sameValue(x, 'outer'); + } +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..67982b3ee2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,17 @@ +// 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 +description: > + for loop block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + for (var i = 0; i < 10; ++i) { + let x = 'inner' + i; + continue; + } + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..48af214652 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,20 @@ +// 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 +description: > + for loop block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + label: for (var i = 0; i < 10; ++i) { + let x = 'middle' + i; + for (var j = 0; j < 10; ++j) { + let x = 'inner' + j; + continue label; + } + } + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..59dc979b90 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,17 @@ +// 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 +description: > + nested block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + label: { + let x = 'inner'; + break label; + } + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..9a1829989a --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,20 @@ +// 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 +description: > + nested block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + label: { + let x = 'middle'; + { + let x = 'inner'; + break label; + } + } + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js b/js/src/tests/test262/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js new file mode 100644 index 0000000000..4a2dd81b07 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js @@ -0,0 +1,32 @@ +// 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 +description: > + outermost binding updated in catch block; nested block let declaration unseen outside of block +---*/ +var caught = false; +try { + { + let xx = 18; + throw 25; + } +} catch (e) { + caught = true; + assert.sameValue(e, 25); + (function () { + try { + // NOTE: This checks that the block scope containing xx has been + // removed from the context chain. + assert.sameValue(xx, undefined); + eval('xx'); + assert(false); // should not reach here + } catch (e2) { + assert(e2 instanceof ReferenceError); + } + })(); +} +assert(caught); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/shell.js b/js/src/tests/test262/language/block-scope/leave/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/shell.js diff --git a/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000..80a14d7677 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,18 @@ +// 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 +description: > + try block let declaration only shadows outer parameter value 1 +---*/ +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch (e) { + assert.sameValue(x, 'outer'); + } +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000..7d0cb8c0f8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,21 @@ +// 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 +description: > + try block let declaration only shadows outer parameter value 2 +---*/ +(function(x) { + try { + let x = 'middle'; + { + let x = 'inner'; + throw 0; + } + } catch (e) { + assert.sameValue(x, 'outer'); + } +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js new file mode 100644 index 0000000000..5bbfaaf087 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-finally-block.js @@ -0,0 +1,22 @@ +// 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 +description: > + verify context in finally block 1 +---*/ +function f() {} + +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch(e) { + + } finally { + f(); + assert.sameValue(x, 'outer'); + } +})('outer'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js new file mode 100644 index 0000000000..17590b18cb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-for-loop-block.js @@ -0,0 +1,20 @@ +// 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 +description: > + verify context in for loop block 2 +---*/ +function f() {} + +(function(x) { + for (var i = 0; i < 10; ++i) { + let x = 'inner'; + continue; + } + f(); + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js new file mode 100644 index 0000000000..32474daf50 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-labelled-block.js @@ -0,0 +1,20 @@ +// 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 +description: > + verify context in labelled block 1 +---*/ +function f() {} + +(function(x) { + label: { + let x = 'inner'; + break label; + } + f(); // The context could be restored from the stack after the call. + assert.sameValue(x, 'outer'); +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js b/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js new file mode 100644 index 0000000000..5b458d4a64 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/verify-context-in-try-block.js @@ -0,0 +1,21 @@ +// 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 +description: > + verify context in try block 1 +---*/ +function f() {} + +(function(x) { + try { + let x = 'inner'; + throw 0; + } catch (e) { + f(); + assert.sameValue(x, 'outer'); + } +})('outer'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js b/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js new file mode 100644 index 0000000000..257e2441ac --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/x-after-break-to-label.js @@ -0,0 +1,19 @@ +// 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 +description: > + x after break to label +---*/ +{ + let x = 2; + L: { + let x = 3; + assert.sameValue(x, 3); + break L; + assert(false); + } + assert.sameValue(x, 2); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/leave/x-before-continue.js b/js/src/tests/test262/language/block-scope/leave/x-before-continue.js new file mode 100644 index 0000000000..b8114ec475 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/leave/x-before-continue.js @@ -0,0 +1,20 @@ +// 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 +description: > + x before continue +---*/ +do { + let x = 4; + assert.sameValue(x, 4); + { + let x = 5; + assert.sameValue(x, 5); + continue; + assert(false); + } +} while (false); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/return-from/block-const.js b/js/src/tests/test262/language/block-scope/return-from/block-const.js new file mode 100644 index 0000000000..d9b77b768b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/return-from/block-const.js @@ -0,0 +1,18 @@ +// 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 +description: > + return from block +---*/ +function fn() { + const u = 3; + { + const v = 6; + return u + v; + } +} +assert.sameValue(fn(), 9); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/return-from/block-let.js b/js/src/tests/test262/language/block-scope/return-from/block-let.js new file mode 100644 index 0000000000..736d829d8b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/return-from/block-let.js @@ -0,0 +1,18 @@ +// 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 +description: > + return from block +---*/ +function fn() { + let x = 3; + { + let y = 6; + return x + y; + } +} +assert.sameValue(fn(), 9); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/return-from/browser.js b/js/src/tests/test262/language/block-scope/return-from/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/return-from/browser.js diff --git a/js/src/tests/test262/language/block-scope/return-from/shell.js b/js/src/tests/test262/language/block-scope/return-from/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/return-from/shell.js diff --git a/js/src/tests/test262/language/block-scope/shadowing/browser.js b/js/src/tests/test262/language/block-scope/shadowing/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/browser.js diff --git a/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js new file mode 100644 index 0000000000..77bfd22f4a --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js @@ -0,0 +1,28 @@ +// 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 +description: > + catch parameter shadowing catch parameter +---*/ +function fn() { + var c = 1; + try { + throw 'stuff3'; + } catch (c) { + try { + throw 'stuff4'; + } catch(c) { + assert.sameValue(c,'stuff4'); + // catch parameter shadowing catch parameter + c = 3; + assert.sameValue(c, 3); + } + assert.sameValue(c, 'stuff3'); + } + assert.sameValue(c, 1); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js new file mode 100644 index 0000000000..30f54026fa --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js @@ -0,0 +1,21 @@ +// 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 +description: > + catch parameter shadowing function parameter name +---*/ +function fn(a) { + try { + throw 'stuff1'; + } catch (a) { + assert.sameValue(a, 'stuff1'); + // catch parameter shadowing function parameter name + a = 2; + assert.sameValue(a, 2); + } +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js new file mode 100644 index 0000000000..215fcf758b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js @@ -0,0 +1,22 @@ +// 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 +description: > + catch parameter shadowing let declaration +---*/ +{ + let a = 3; + try { + throw 'stuff2'; + } catch (a) { + assert.sameValue(a, 'stuff2'); + // catch parameter shadowing let declaration + a = 4; + assert.sameValue(a, 4); + } + assert.sameValue(a, 3); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js new file mode 100644 index 0000000000..f12b667704 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js @@ -0,0 +1,21 @@ +// 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 +description: > + catch parameter shadowing var variable +---*/ +function fn() { + var a = 1; + try { + throw 'stuff3'; + } catch (a) { + // catch parameter shadowing var variable + assert.sameValue(a, 'stuff3'); + } + assert.sameValue(a, 1); +} +fn(); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js b/js/src/tests/test262/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000..963ed3302e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js @@ -0,0 +1,25 @@ +// 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 +description: > + const declaration shadowing catch parameter +---*/ +function fn() { + var a = 1; + try { + throw 'stuff3'; + } catch (a) { + { + // const declaration shadowing catch parameter + const a = 3; + assert.sameValue(a, 3); + } + assert.sameValue(a, 'stuff3'); + } + assert.sameValue(a, 1); +} +fn(); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js b/js/src/tests/test262/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js new file mode 100644 index 0000000000..fa31e802cb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js @@ -0,0 +1,31 @@ +// 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 +description: > + const declarations shadowing parameter name, let, const and var variables +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + { + const a = 2; + const b = 2; + const c = 2; + const d = 2; + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + } + + assert.sameValue(a, 1); + assert.sameValue(b, 1); + assert.sameValue(c, 1); + assert.sameValue(d, 1); +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-from-closure.js b/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-from-closure.js new file mode 100644 index 0000000000..0f69d01cfe --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-from-closure.js @@ -0,0 +1,30 @@ +// 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 +description: > + dynamic lookup from closure +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + function f() { + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } + + f(); + } +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js b/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000..038e71b55b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js @@ -0,0 +1,27 @@ +// 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 +description: > + dynamic lookup in and through block contexts +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } +} + +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js b/js/src/tests/test262/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js new file mode 100644 index 0000000000..de270a9f74 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js @@ -0,0 +1,19 @@ +// 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 +description: > + hoisting var declarations out of blocks +---*/ +function fn() { + { + var x = 1; + var y; + } + assert.sameValue(x, 1); + assert.sameValue(y, undefined); +} +fn(); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js b/js/src/tests/test262/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000..cbe153281f --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js @@ -0,0 +1,20 @@ +// 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 +description: > + let declaration shadowing catch parameter +---*/ +try { + throw 'stuff1'; +} catch (a) { + { + // let declaration shadowing catch parameter + let a = 3; + assert.sameValue(a, 3); + } + assert.sameValue(a, 'stuff1'); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js b/js/src/tests/test262/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000..3f1a781bf8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,26 @@ +// 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 +description: > + let declarations shadowing parameter name, let, const and var +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + { + let a = 2; + let b = 2; + let c = 2; + let d = 2; + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + } +} +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/lookup-from-closure.js b/js/src/tests/test262/language/block-scope/shadowing/lookup-from-closure.js new file mode 100644 index 0000000000..38139e812c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/lookup-from-closure.js @@ -0,0 +1,30 @@ +// 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 +description: > + lookup from closure +---*/ +function f5(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + function f() { + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } + + f(); + } +} +f5(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js b/js/src/tests/test262/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000..3700de243d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js @@ -0,0 +1,27 @@ +// 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 +description: > + lookup in and through block contexts +---*/ +function fn(one) { + var x = one + 1; + let y = one + 2; + const u = one + 4; + { + let z = one + 3; + const v = one + 5; + assert.sameValue(one, 1); + assert.sameValue(x, 2); + assert.sameValue(y, 3); + assert.sameValue(z, 4); + assert.sameValue(u, 5); + assert.sameValue(v, 6); + } +} + +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js b/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js new file mode 100644 index 0000000000..1ec2063cee --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js @@ -0,0 +1,25 @@ +// 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 +description: > + parameter name shadowing catch parameter +---*/ +function fn() { + var c = 1; + try { + throw 'stuff3'; + } catch (c) { + (function(c) { + // parameter name shadowing catch parameter + c = 3; + assert.sameValue(c, 3); + })(); + assert.sameValue(c, 'stuff3'); + } + assert.sameValue(c, 1); +} +fn(); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js b/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000..e8194ce346 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,34 @@ +// 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 +description: > + parameter name shadowing parameter name, let, const and var +---*/ +function fn(a) { + let b = 1; + var c = 1; + const d = 1; + + (function(a, b, c, d) { + a = 2; + b = 2; + c = 2; + d = 2; + + assert.sameValue(a, 2); + assert.sameValue(b, 2); + assert.sameValue(c, 2); + assert.sameValue(d, 2); + })(1, 1); + + assert.sameValue(a, 1); + assert.sameValue(b, 1); + assert.sameValue(c, 1); + assert.sameValue(d, 1); +} + +fn(1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/shadowing/shell.js b/js/src/tests/test262/language/block-scope/shadowing/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shadowing/shell.js diff --git a/js/src/tests/test262/language/block-scope/shell.js b/js/src/tests/test262/language/block-scope/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/shell.js diff --git a/js/src/tests/test262/language/block-scope/syntax/browser.js b/js/src/tests/test262/language/block-scope/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/browser.js diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-array.js b/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-array.js new file mode 100644 index 0000000000..66a0be39dd --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-array.js @@ -0,0 +1,43 @@ +// 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 +description: > + for-in to acquire properties from array +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array; +} +var subject; + +subject = props([]); +assert.sameValue(subject.length, 0, "[]: length"); +assert.sameValue(subject[0], undefined, "[]: first property"); +assert.sameValue(subject[1], undefined, "[]: second property"); +assert.sameValue(subject[2], undefined, "[]: third property"); +assert.sameValue(subject[3], undefined, "[]: fourth property"); + +subject = props([1]); +assert.sameValue(subject.length, 1, "[1]: length"); +assert.sameValue(subject[0], "0", "[1]: first property"); +assert.sameValue(subject[1], undefined, "[1]: second property"); +assert.sameValue(subject[2], undefined, "[1]: third property"); +assert.sameValue(subject[3], undefined, "[1]: fourth property"); + +subject = props([1, 2]); +assert.sameValue(subject.length, 2, "[1, 2]: length"); +assert.sameValue(subject[0], "0", "[1, 2]: first property"); +assert.sameValue(subject[1], "1", "[1, 2]: second property"); +assert.sameValue(subject[2], undefined, "[1, 2]: third property"); +assert.sameValue(subject[3], undefined, "[1, 2]: fourth property"); + +subject = props([1, 2, 3]); +assert.sameValue(subject.length, 3, "[1, 2, 3]: length"); +assert.sameValue(subject[0], "0", "[1, 2, 3]: first property"); +assert.sameValue(subject[1], "1", "[1, 2, 3]: second property"); +assert.sameValue(subject[2], "2", "[1, 2, 3]: third property"); +assert.sameValue(subject[3], undefined, "[1, 2, 3]: fourth property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-object.js b/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-object.js new file mode 100644 index 0000000000..9016fb3b1d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/acquire-properties-from-object.js @@ -0,0 +1,43 @@ +// 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 +description: > + for-in to acquire properties from object +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array; +} +var subject; + +subject = props({}); +assert.sameValue(subject.length, 0, "{}: length"); +assert.sameValue(subject[0], undefined, "{}: first property"); +assert.sameValue(subject[1], undefined, "{}: second property"); +assert.sameValue(subject[2], undefined, "{}: third property"); +assert.sameValue(subject[3], undefined, "{}: fourth property"); + +subject = props({x:1}); +assert.sameValue(subject.length, 1, "{x:1}: length"); +assert.sameValue(subject[0], "x", "{x:1}: first property"); +assert.sameValue(subject[1], undefined, "{x:1}: second property"); +assert.sameValue(subject[2], undefined, "{x:1}: third property"); +assert.sameValue(subject[3], undefined, "{x:1}: fourth property"); + +subject = props({x:1, y:2}); +assert.sameValue(subject.length, 2, "{x:1, y:2}: length"); +assert.sameValue(subject[0], "x", "{x:1, y:2}: first property"); +assert.sameValue(subject[1], "y", "{x:1, y:2}: second property"); +assert.sameValue(subject[2], undefined, "{x:1, y:2}: third property"); +assert.sameValue(subject[3], undefined, "{x:1, y:2}: fourth property"); + +subject = props({x:1, y:2, zoom:3}); +assert.sameValue(subject.length, 3, "{x:1, y:2, zoom:3}: length"); +assert.sameValue(subject[0], "x", "{x:1, y:2, zoom:3}: first property"); +assert.sameValue(subject[1], "y", "{x:1, y:2, zoom:3}: second property"); +assert.sameValue(subject[2], "zoom", "{x:1, y:2, zoom:3}: third property"); +assert.sameValue(subject[3], undefined, "{x:1, y:2, zoom:3}: fourth property"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/browser.js b/js/src/tests/test262/language/block-scope/syntax/for-in/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/browser.js diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-initialization-assignment.js b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-initialization-assignment.js new file mode 100644 index 0000000000..6eb679df1e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-initialization-assignment.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + for declaration: + disallow initialization assignment +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let x = 3 in {}) { } + diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js new file mode 100644 index 0000000000..67383a0210 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + for declaration: + disallow multiple lexical bindings, with and without initializer +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let x = 3, y in {}) { } + diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js new file mode 100644 index 0000000000..36c2e9c22a --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + for declaration: + disallow multiple lexical bindings, with initializer +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let x = 3, y = 4 in {}) { } + diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js new file mode 100644 index 0000000000..84f9c83688 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + for declaration: + disallow multiple lexical bindings, without and with initializer +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let x, y = 4 in {}) { } + diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js new file mode 100644 index 0000000000..550974ced8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + for declaration: + disallow multiple lexical bindings +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (let x, y in {}) { } + diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/mixed-values-in-iteration.js b/js/src/tests/test262/language/block-scope/syntax/for-in/mixed-values-in-iteration.js new file mode 100644 index 0000000000..85f2c0bf4e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/mixed-values-in-iteration.js @@ -0,0 +1,22 @@ +// 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 +description: > + Mixed values in iteration +---*/ +function fn(x) { + let a = []; + for (let p in x) { + a.push(function () { return p; }); + } + let k = 0; + for (let q in x) { + assert.sameValue(q, a[k]()); + ++k; + } +} +fn({a : [0], b : 1, c : {v : 1}, get d() {}, set e(x) {}}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/for-in/shell.js b/js/src/tests/test262/language/block-scope/syntax/for-in/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/for-in/shell.js diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/browser.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/browser.js diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js new file mode 100644 index 0000000000..0d4a759993 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js @@ -0,0 +1,12 @@ +// 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 +description: > + function declarations in statement position in strict mode: + case Expression : StatementList +---*/ +switch (true) { case true: function g() {} } + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js new file mode 100644 index 0000000000..cb656254c0 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js @@ -0,0 +1,12 @@ +// 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 +description: > + function declarations in statement position in strict mode: + default : StatementList +---*/ +switch (true) { default: function g() {} } + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js new file mode 100644 index 0000000000..7e21f7ff75 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + function declarations in statement position: + do Statement while ( Expression ) +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +do function g() {} while (false) + diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js new file mode 100644 index 0000000000..f69e43ff18 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + function declarations in statement position: + for ( ;;) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +for (;false;) function g() {} + diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement-strict.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement-strict.js new file mode 100644 index 0000000000..548fffc8fb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// 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 +description: > + function declarations in statement position in strict mode: + if ( Expression ) Statement else Statement +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +if (true) {} else function g() {} + diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-strict.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-strict.js new file mode 100644 index 0000000000..63d057e96d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// 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 +description: > + function declarations in statement position in strict mode: + if ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +if (true) function g() {} + diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js new file mode 100644 index 0000000000..69063f05f3 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// 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 +description: > + function declarations in statement position: + while ( Expression ) Statement +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +while (false) function g() {} + diff --git a/js/src/tests/test262/language/block-scope/syntax/function-declarations/shell.js b/js/src/tests/test262/language/block-scope/syntax/function-declarations/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/function-declarations/shell.js diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js new file mode 100644 index 0000000000..a690fce961 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js @@ -0,0 +1,12 @@ +// 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 +description: > + redeclaration outermost: + allowed to declare function with function declaration +---*/ +function f() {} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js new file mode 100644 index 0000000000..0a935e2eed --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js @@ -0,0 +1,12 @@ +// 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 +description: > + redeclaration outermost: + allowed to redeclare function declaration with var +---*/ +function f() {} var f; + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js new file mode 100644 index 0000000000..84dc183b7f --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js @@ -0,0 +1,12 @@ +// 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 +description: > + redeclaration outermost: + allowed to redeclare var with function declaration +---*/ +var f; function f() {} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/browser.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/browser.js diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/shell.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration-global/shell.js diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..30e9060835 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..f0090c5c2c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..fd0003513b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-class.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with ClassDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..2d2da8c965 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-const.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..63838a6d0d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..7c6ddaf799 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..60bf796a9c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-let.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..df21e890e6 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-var.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-async-function-declaration.template +/*--- +description: redeclaration with VariableDeclaration (AsyncFunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {} var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..3c23f35b63 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..a5a05f0cef --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..762c243df1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-class.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with ClassDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..3063589f2c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-const.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..fe967de833 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..4309c5c10d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..8704f96a24 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-let.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..50011a54f4 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/async-generator-name-redeclaration-attempt-with-var.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-async-generator-declaration.template +/*--- +description: redeclaration with VariableDeclaration (AsyncGeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {} var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/browser.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/browser.js diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..af383c677c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..89127b7a0e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..d7750c679d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with ClassDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..2a170d5ba9 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..6d18ab875d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-function.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..8707b6397e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..0d497ceada --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..bff3e380a6 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/class-name-redeclaration-attempt-with-var.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-class-declaration.template +/*--- +description: redeclaration with VariableDeclaration (ClassDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {} var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..be6f6d7470 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..72c84df655 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..9bfda25bfc --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with ClassDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..7735c597b1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..6bf53adcdc --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-function.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..68a8db29c8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..d531c94df7 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..ffd66089ae --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/const-name-redeclaration-attempt-with-var.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-const-declaration.template +/*--- +description: redeclaration with VariableDeclaration (LexicalDeclaration (const) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..5ce0b8096f --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { async function f() {}; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..13a398f6fe --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { async function* f() {}; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..3504d76bfb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with ClassDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { class f {}; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..b6fc7ff7bc --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { const f = 0; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..00d1a1427d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { function f() {}; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..54e206c3aa --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { function* f() {}; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..f75f2d3d92 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +function x() { + { let f; var f; } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..2ad1fd58eb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-var.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/fn-block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with VariableDeclaration (VariableDeclaration in BlockStatement inside a function) +esid: sec-block-static-semantics-early-errors +flags: [generated] +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +---*/ + + +function x() { + { var f; var f } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js new file mode 100644 index 0000000000..3c72d3aeb1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-block-static-semantics-early-errors +description: > + Redeclaration with VariableDeclaration (FunctionDeclaration in BlockStatement) +info: | + 13.2.1 Static Semantics: Early Errors + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function g() { + // Create an outer block-statement. + { + // A lexically declared function declaration. + function f() {} + + // An inner block-statement with a variable-declared name. + { + var f; + } + } +} diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..e96e49fcb5 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..ffd109e6d0 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..6bdeb6dceb --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with ClassDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..6f0622cf5a --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js new file mode 100644 index 0000000000..de89b4b02b --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-function-strict.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..e1fe7d8417 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..793027ea79 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..a6b0fdc033 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/function-name-redeclaration-attempt-with-var.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-function-declaration.template +/*--- +description: redeclaration with VariableDeclaration (FunctionDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..602f2e33a4 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..c73e8355d4 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..a3f3322da9 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-class.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with ClassDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..6e918b52a8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-const.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..12495cfc56 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..72597b350c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..3099228f20 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-let.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..57b9ad552f --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/generator-name-redeclaration-attempt-with-var.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-generator-declaration.template +/*--- +description: redeclaration with VariableDeclaration (GeneratorDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {} var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..9251a7886e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } async function f() {}; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..38a095ef55 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } async function* f() {}; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..8d31296d14 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-class.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with ClassDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } class f {}; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..a3023384ad --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-const.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } const f = 0; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..8bcb39e45e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-function.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..e20a966469 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } function* f() {}; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..85b7fe4059 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-let.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ { var f; } let f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..2920168bc9 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-name-redeclaration-attempt-with-var.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-inner-block-var-declaration.template +/*--- +description: redeclaration with VariableDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. +---*/ + + +{ { var f; } var f } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-function.js new file mode 100644 index 0000000000..136d49a177 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-function.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {}; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-generator.js new file mode 100644 index 0000000000..df37d53238 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-async-generator.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {}; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js new file mode 100644 index 0000000000..33de9aeb71 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-class.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with ClassDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {}; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-const.js new file mode 100644 index 0000000000..5c9984bd42 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-const.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with const-LexicalDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-function.js new file mode 100644 index 0000000000..e66637fcab --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-function.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with FunctionDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {} { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-generator.js new file mode 100644 index 0000000000..0ea32cdcca --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-generator.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with GeneratorDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {}; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-let.js new file mode 100644 index 0000000000..42e8ad738f --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/inner-block-var-redeclaration-attempt-after-let.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-inner-block-var-declaration-after.template +/*--- +description: redeclaration with let-LexicalDeclaration (VariableDeclaration in a BlockStatement inside a BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + + Static Semantics: VarDeclaredNames + + Block : { } + + 1. Return a new empty List. + + StatementList : StatementList StatementListItem + + 1. Let names be VarDeclaredNames of StatementList. + 2. Append to names the elements of the VarDeclaredNames of StatementListItem. + 3. Return names. + + StatementListItem : Declaration + + 1. Return a new empty List. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; { var f; } } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..fb96dc7bb1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..a995140cdd --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..135a5bed29 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with ClassDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..892a392c97 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..333ad27641 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-function.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..04edfcad88 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..b5fca41af8 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains + any duplicate entries. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..6392dbe7e3 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/let-name-redeclaration-attempt-with-var.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-let-declaration.template +/*--- +description: redeclaration with VariableDeclaration (LexicalDeclaration (let) in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; var f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/shell.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/shell.js diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js new file mode 100644 index 0000000000..eb00396e65 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; async function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js new file mode 100644 index 0000000000..6dab6dafdd --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; async function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js new file mode 100644 index 0000000000..654bd6b30c --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with ClassDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; class f {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js new file mode 100644 index 0000000000..60bbde7e91 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with const-LexicalDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; const f = 0 } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js new file mode 100644 index 0000000000..71354827e1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-function.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with FunctionDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; function f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js new file mode 100644 index 0000000000..9646700107 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with GeneratorDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; function* f() {} } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js new file mode 100644 index 0000000000..210531fa16 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with let-LexicalDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ var f; let f } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js new file mode 100644 index 0000000000..d020ff2b3d --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-name-redeclaration-attempt-with-var.js @@ -0,0 +1,18 @@ +// This file was procedurally generated from the following sources: +// - src/declarations/var.case +// - src/declarations/redeclare-allow-var/block-attempt-to-redeclare-var-declaration.template +/*--- +description: redeclaration with VariableDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. +---*/ + + +{ var f; var f } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js new file mode 100644 index 0000000000..e109c7ef21 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-function.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with AsyncFunctionDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ async function f() {}; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js new file mode 100644 index 0000000000..44dd1f42b5 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-async-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/async-generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with AsyncGeneratorDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ async function* f() {}; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js new file mode 100644 index 0000000000..73545ef577 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-class.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/class.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with ClassDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ class f {}; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-const.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-const.js new file mode 100644 index 0000000000..79a377240e --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-const.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/const.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with const-LexicalDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ const f = 0; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js new file mode 100644 index 0000000000..ea49a0be89 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-function.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/function.case +// - src/declarations/redeclare-allow-sloppy-function/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with FunctionDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ function f() {}; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js new file mode 100644 index 0000000000..3a9d0015a1 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-generator.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/generator.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with GeneratorDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ function* f() {}; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-let.js b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-let.js new file mode 100644 index 0000000000..a8b415ff28 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/redeclaration/var-redeclaration-attempt-after-let.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/declarations/let.case +// - src/declarations/redeclare/block-attempt-to-redeclare-var-declaration-after.template +/*--- +description: redeclaration with let-LexicalDeclaration (VariableDeclaration in BlockStatement) +esid: sec-block-static-semantics-early-errors +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Block : { StatementList } + + It is a Syntax Error if any element of the LexicallyDeclaredNames of + StatementList also occurs in the VarDeclaredNames of StatementList. + +---*/ + + +$DONOTEVALUATE(); + +{ let f; var f; } diff --git a/js/src/tests/test262/language/block-scope/syntax/shell.js b/js/src/tests/test262/language/block-scope/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/block-scope/syntax/shell.js |