diff --git a/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000000000000000000000000000000000..e979fd17cbcffd719da711f0d57024d210fbee6f --- /dev/null +++ b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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) {} + diff --git a/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000000000000000000000000000000000..49a69b91d7184a33fa95569558f7bf30d1de11e8 --- /dev/null +++ b/test/language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000000000000000000000000000000000..43aad6ab245bb3e294a8116258632a9167dc97ae --- /dev/null +++ b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000000000000000000000000000000000..93b7daa94d575711449edf038b24b7fe0dd59b4c --- /dev/null +++ b/test/language/block-scope/leave/for-loop-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000000000000000000000000000000000..5625eddc8b2e537a3cf494bd49decd35786de971 --- /dev/null +++ b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000000000000000000000000000000000..9a668e26b58d5a2f20e7fbf8ab60dd0969dc95e8 --- /dev/null +++ b/test/language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js b/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js new file mode 100644 index 0000000000000000000000000000000000000000..071691355c18cdfacb266ba92b4f0cbbe49fd642 --- /dev/null +++ b/test/language/block-scope/leave/outermost-binding-updated-in-catch-block-nested-block-let-declaration-unseen-outside-of-block.js @@ -0,0 +1,30 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js new file mode 100644 index 0000000000000000000000000000000000000000..bf1a0d12ed02b7682a672cc63e7234eed474f909 --- /dev/null +++ b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-1.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js new file mode 100644 index 0000000000000000000000000000000000000000..bbbf5469e9f984c89c30ceae2042059dd655070d --- /dev/null +++ b/test/language/block-scope/leave/try-block-let-declaration-only-shadows-outer-parameter-value-2.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/verify-context-in-finally-block.js b/test/language/block-scope/leave/verify-context-in-finally-block.js new file mode 100644 index 0000000000000000000000000000000000000000..9eeadaacd2e8201e8a86218b107d30ab76b59fc6 --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-finally-block.js @@ -0,0 +1,20 @@ +// Copyright (C) Copyright 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'); diff --git a/test/language/block-scope/leave/verify-context-in-for-loop-block.js b/test/language/block-scope/leave/verify-context-in-for-loop-block.js new file mode 100644 index 0000000000000000000000000000000000000000..ff0fee370992fd9cf4d949beed5ec2d62006c58d --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-for-loop-block.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/verify-context-in-labelled-block.js b/test/language/block-scope/leave/verify-context-in-labelled-block.js new file mode 100644 index 0000000000000000000000000000000000000000..2e43de15ba40658ca75cf3c4fa2a17070e8184aa --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-labelled-block.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/verify-context-in-try-block.js b/test/language/block-scope/leave/verify-context-in-try-block.js new file mode 100644 index 0000000000000000000000000000000000000000..d8f540cd345703224b9157010bcb2af1c271532f --- /dev/null +++ b/test/language/block-scope/leave/verify-context-in-try-block.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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'); + diff --git a/test/language/block-scope/leave/x-after-break-to-label.js b/test/language/block-scope/leave/x-after-break-to-label.js new file mode 100644 index 0000000000000000000000000000000000000000..7ec8612cac7c223fa8ee9064f98b37bf4d746a2a --- /dev/null +++ b/test/language/block-scope/leave/x-after-break-to-label.js @@ -0,0 +1,17 @@ +// Copyright (C) Copyright 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); +} diff --git a/test/language/block-scope/leave/x-before-continue.js b/test/language/block-scope/leave/x-before-continue.js new file mode 100644 index 0000000000000000000000000000000000000000..9e8041b92a1a0d039cb7f4ff0fbf42699e0a312a --- /dev/null +++ b/test/language/block-scope/leave/x-before-continue.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/return-from/block-const.js b/test/language/block-scope/return-from/block-const.js new file mode 100644 index 0000000000000000000000000000000000000000..ad08438220898fc9bef6dbee28fce2f05dffc31d --- /dev/null +++ b/test/language/block-scope/return-from/block-const.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/return-from/block-let.js b/test/language/block-scope/return-from/block-let.js new file mode 100644 index 0000000000000000000000000000000000000000..f0505ede745fefe13a72225395426f2e82b3cf24 --- /dev/null +++ b/test/language/block-scope/return-from/block-let.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..342fb1a73d9dcd42eb5f6659ba81f646552f6f89 --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-closure-get-before-initialization.js @@ -0,0 +1,15 @@ +// Copyright (C) Copyright 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: block local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { return x + 1; } + f(); + const x = 1; +} + diff --git a/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..a95cc15d7462e9f533f8c4d221c7df76980258b0 --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + const x = x + 1; +} diff --git a/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..10523d69afbf7e16c404d1edc5c8b79da86d4e7f --- /dev/null +++ b/test/language/block-scope/semantics/const/block-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + x; const x = 1; +} diff --git a/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..49fa8a3dc9b08c67276139bd168907e37068f1a9 --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: function local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { return x + 1; } + f(); + const x = 1; +}()); diff --git a/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..8ae0722b1a65cd4bc02f4a24ea9072451387b1ae --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + const x = x + 1; +}()); diff --git a/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..9e853029ce1b3fb1f85aec184a9a4d10a8270578 --- /dev/null +++ b/test/language/block-scope/semantics/const/function-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + x; const x = 1; +}()); diff --git a/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js b/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..68674108df1bbd5e64bbd7b51f6fce530420f968 --- /dev/null +++ b/test/language/block-scope/semantics/const/global-closure-get-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: global closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { return x + 1; } +f(); +const x = 1; diff --git a/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..37462a91f8cc3c2f79fa6be3e1aa41aa9878b914 --- /dev/null +++ b/test/language/block-scope/semantics/const/global-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +const x = x + 1; diff --git a/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..0dce38e5bfd84e70b87a0e023308711daf6b486b --- /dev/null +++ b/test/language/block-scope/semantics/const/global-use-before-initialization-in-prior-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +x; const x = 1; diff --git a/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..32eb4bb6f0cec12681b9d6f9b5c116369bafbd91 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: block local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { return x + 1; } + f(); + let x; +} diff --git a/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..04232246d6075d7c8c3e765d5906fbf4182e5b0c --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-closure-set-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: block local closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + function f() { x = 1; } + f(); + let x; +} diff --git a/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..6e9536d054bcebe2f891c5aeb7c513f42755aa80 --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + let x = x + 1; +} diff --git a/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..ca21029312b5edee361958a8695fb572211db75d --- /dev/null +++ b/test/language/block-scope/semantics/let/block-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: block local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +{ + x; let x; +} diff --git a/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..2d844117574f78b1137c70bf227cab835cff09eb --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-closure-get-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: function local closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { return x + 1; } + f(); + let x; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..857e9abf86a64e4501b978338480f22786faa74f --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-closure-set-before-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: function local closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + function f() { x = 1; } + f(); + let x; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..3bd63de4ba890cd9daa60fbd80fcc2283304ac95 --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + let x = x + 1; +}()); diff --git a/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..9d9c2bbe40ff22ad6b396d600f648606aedc4ef3 --- /dev/null +++ b/test/language/block-scope/semantics/let/function-local-use-before-initialization-in-prior-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: function local use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +(function() { + x; let x; +}()); diff --git a/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js b/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..5b4af8befba330a3746521d7c27b9c32894f3261 --- /dev/null +++ b/test/language/block-scope/semantics/let/global-closure-get-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: global closure [[Get]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { return x + 1; } +f(); +let x; diff --git a/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js b/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..cf0c32bc5eb3538664cee93660007700d89bcf96 --- /dev/null +++ b/test/language/block-scope/semantics/let/global-closure-set-before-initialization.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: global closure [[Set]] before initialization. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +function f() { x = 1; } +f(); +let x; diff --git a/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js b/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..7ba56f6e7d6dc5b7465daae4dc28239075f3962a --- /dev/null +++ b/test/language/block-scope/semantics/let/global-use-before-initialization-in-declaration-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in declaration statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +let x = x + 1; diff --git a/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js b/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..e327554fe883b18191bc3dcf4bffbc1eee4dab21 --- /dev/null +++ b/test/language/block-scope/semantics/let/global-use-before-initialization-in-prior-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: global use before initialization in prior statement. + (TDZ, Temporal Dead Zone) +negative: ReferenceError +---*/ +x; let x; diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js new file mode 100644 index 0000000000000000000000000000000000000000..551a7608c42c598f45730dd2dee156594a1ef4e0 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-catch-parameter.js @@ -0,0 +1,26 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js new file mode 100644 index 0000000000000000000000000000000000000000..6fc91f4351a8a174869fd0c78f157696db076290 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-function-parameter-name.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..b67af4f6145cce891f8b8b814ebc86586935e8cf --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-let-declaration.js @@ -0,0 +1,20 @@ +// Copyright (C) Copyright 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); +} + diff --git a/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js b/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js new file mode 100644 index 0000000000000000000000000000000000000000..c499f2bdeefaffd66aa706db55bdb293f2616c63 --- /dev/null +++ b/test/language/block-scope/shadowing/catch-parameter-shadowing-var-variable.js @@ -0,0 +1,19 @@ +// Copyright (C) Copyright 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(); + diff --git a/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000000000000000000000000000000000..ba690dffc3c1e17f7bd0feea47a7f1a42e10d592 --- /dev/null +++ b/test/language/block-scope/shadowing/const-declaration-shadowing-catch-parameter.js @@ -0,0 +1,23 @@ +// Copyright (C) Copyright 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(); + diff --git a/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js b/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js new file mode 100644 index 0000000000000000000000000000000000000000..f8a1120291f58e86677d60c27ea8ec5ca52dbe47 --- /dev/null +++ b/test/language/block-scope/shadowing/const-declarations-shadowing-parameter-name-let-const-and-var-variables.js @@ -0,0 +1,29 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js b/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js new file mode 100644 index 0000000000000000000000000000000000000000..c42128aa9e1dd0bfb475a0f78b179ce7134c905e --- /dev/null +++ b/test/language/block-scope/shadowing/dynamic-lookup-from-closure.js @@ -0,0 +1,28 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js b/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000000000000000000000000000000000..39654afa9f1de8af19a358c2bb02f2c712fe5c64 --- /dev/null +++ b/test/language/block-scope/shadowing/dynamic-lookup-in-and-through-block-contexts.js @@ -0,0 +1,25 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js b/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js new file mode 100644 index 0000000000000000000000000000000000000000..9be40074d5da2a8418e8085b9640e7c8f661cb9c --- /dev/null +++ b/test/language/block-scope/shadowing/hoisting-var-declarations-out-of-blocks.js @@ -0,0 +1,17 @@ +// Copyright (C) Copyright 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(); + diff --git a/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js new file mode 100644 index 0000000000000000000000000000000000000000..63aa11749b757244e46784586c198e2717ab4780 --- /dev/null +++ b/test/language/block-scope/shadowing/let-declaration-shadowing-catch-parameter.js @@ -0,0 +1,18 @@ +// Copyright (C) Copyright 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'); +} + diff --git a/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js b/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000000000000000000000000000000000..a1e0ebe3a6a98cf8a4101ae58f59aa7ecd959899 --- /dev/null +++ b/test/language/block-scope/shadowing/let-declarations-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,24 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/lookup-from-closure.js b/test/language/block-scope/shadowing/lookup-from-closure.js new file mode 100644 index 0000000000000000000000000000000000000000..76f567533e067578b1ccd540982fd29023dd6885 --- /dev/null +++ b/test/language/block-scope/shadowing/lookup-from-closure.js @@ -0,0 +1,28 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js b/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js new file mode 100644 index 0000000000000000000000000000000000000000..d970491089937387dcd682fb0db1bc7f06dc5f09 --- /dev/null +++ b/test/language/block-scope/shadowing/lookup-in-and-through-block-contexts.js @@ -0,0 +1,25 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js b/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js new file mode 100644 index 0000000000000000000000000000000000000000..b14b1ec5dd18dec1b4a6d07053c238a4c60839a5 --- /dev/null +++ b/test/language/block-scope/shadowing/parameter-name-shadowing-catch-parameter.js @@ -0,0 +1,23 @@ +// Copyright (C) Copyright 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(); + diff --git a/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js b/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js new file mode 100644 index 0000000000000000000000000000000000000000..5962c91074e5f236eb477433ef0b775c43c32802 --- /dev/null +++ b/test/language/block-scope/shadowing/parameter-name-shadowing-parameter-name-let-const-and-var.js @@ -0,0 +1,32 @@ +// Copyright (C) Copyright 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); + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js new file mode 100644 index 0000000000000000000000000000000000000000..7f9dadbb6add3fcbc7a0bce38aed9ba4bf94f247 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-with-without-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 mixed: with, without initialiser +negative: SyntaxError +---*/ +const x = 1, y; + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js new file mode 100644 index 0000000000000000000000000000000000000000..499b2f6bacdb37e5122321c3830f83b53ef64235 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-mixed-without-with-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 mixed: without, with initialiser +negative: SyntaxError +---*/ +const x, y = 1; + diff --git a/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js new file mode 100644 index 0000000000000000000000000000000000000000..eb25aed37ceed1a21fad53a31f254b6f7cdd2fb1 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/block-scope-syntax-const-declarations-without-initialiser.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialiser +negative: SyntaxError +---*/ +const x; + diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js b/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..bfbe27642e807a06eafd067b5b570d59101ceb99 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-case-expression-statement-list.js @@ -0,0 +1,9 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + case Expression : StatementList +---*/ +switch (true) { case true: const x = 1; } diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js b/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..da83201112be9c5b56320cecbee420ffd888f891 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-default-statement-list.js @@ -0,0 +1,9 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + default : StatementList +---*/ +switch (true) { default: const x = 1; } diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js b/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..f9cb34569848d3a048124572e606fbbd3eddf0a5 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do const x = 1; while (false) diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..9b3268aa8a98f62096960d7b4e3721a297557f45 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..f451958439822d1ebc811cb2ec81a11b5092ec83 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..dada7d9803d126509b527cf0a0c566ad94c70bf3 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..6e34c42c4e7cdcd927d8859858d4f806a73dd4e6 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js b/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..7b6ac9f4c8b5e48ac777a6096467cb036536ad39 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/with-initializer-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) const x = 1; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js b/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..6774916c925da3f82bfb8954cdcc9b5d2921be90 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + case Expression : StatementList +negative: SyntaxError +---*/ +switch (true) { case true: const x; } diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js b/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..e8b991af369bee6503b3fb5662acb7a2eab54925 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + default : StatementList +negative: SyntaxError +---*/ +switch (true) { default: const x; } diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js b/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..a25b68e02a61005c3094f0cedd693a4f3b63ae75 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do const x; while (false) diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..761519eaa30b52dfdd43599c3c39a211b191e0a5 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..281f7192e73f7764726520c82f5402c269a95b1f --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..8eb91adbf42c9efd058eae8ef2483c1ff46c5417 --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..f7d8644064f6c02a1ab7995ea80c3d881953defc --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: const x; diff --git a/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js b/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..d6b74ca65793cf6ffcbc485438a9087d9048a1fa --- /dev/null +++ b/test/language/block-scope/syntax/const-declaration/without-initializer-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) const x; diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js new file mode 100644 index 0000000000000000000000000000000000000000..ba3065930851a7f85e57e0ec63d66aeff10b01a7 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-array.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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 +includes: [compareArray.js] +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array.sort(); +} + +assert.sameValue(props([]).length, 0); +assert.sameValue(props([1]).length, 1); +assert.sameValue(props([1,2]).length, 2); + +assert(compareArray(props([1]), ["0"])); +assert(compareArray(props([1,2]), ["0", "1"])); +assert(compareArray(props([1,2,3]), ["0", "1", "2"])); diff --git a/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js new file mode 100644 index 0000000000000000000000000000000000000000..59f21cec33702f9b58b482021f8d765ed2680b37 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/acquire-properties-from-object.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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 +includes: [compareArray.js] +---*/ +function props(x) { + var array = []; + for (let p in x) array.push(p); + return array.sort(); +} + +assert.sameValue(props({}).length, 0); +assert.sameValue(props({x:1}).length, 1); +assert.sameValue(props({x:1, y:2}).length, 2); + +assert(compareArray(props({x:1}), ["x"])); +assert(compareArray(props({x:1, y:2}), ["x", "y"])); +assert(compareArray(props({x:1, y:2, zoom:3}), ["x", "y", "zoom"])); diff --git a/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js b/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js new file mode 100644 index 0000000000000000000000000000000000000000..ebd348dc214fb55e6d8744d4637ac3e7c346140a --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-initialization-assignment.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (let x = 3 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js new file mode 100644 index 0000000000000000000000000000000000000000..f1f23b0790ed1b10fbe47d687f3aca64a2b8ba7d --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-and-without-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (let x = 3, y in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js new file mode 100644 index 0000000000000000000000000000000000000000..5f05dda5557358aafd57950bb721b76434de4a3b --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-with-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (let x = 3, y = 4 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js new file mode 100644 index 0000000000000000000000000000000000000000..0f77451a9135badaccaa777f84b39977edccc963 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings-without-and-with-initializer.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (let x, y = 4 in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js new file mode 100644 index 0000000000000000000000000000000000000000..14ac88f2c91a5516a37b0394bca104db02fa374c --- /dev/null +++ b/test/language/block-scope/syntax/for-in/disallow-multiple-lexical-bindings.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: SyntaxError +---*/ +for (let x, y in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js b/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js new file mode 100644 index 0000000000000000000000000000000000000000..8c6f938b877729bd6a3907268bb72d3be1a6e0f6 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/missing-identifier-let-disallowed-as-bound-name.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 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: + missing identifier, "let" disallowed as bound name +negative: SyntaxError +---*/ +for (let in {}) { } + diff --git a/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js b/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js new file mode 100644 index 0000000000000000000000000000000000000000..6fe99733462f88220f5d01482bfeb5299cd04a53 --- /dev/null +++ b/test/language/block-scope/syntax/for-in/mixed-values-in-iteration.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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 +---*/ +"use strict"; +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) {}}); + diff --git a/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js b/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..002697cd099bf7efd2a8b22cecc88deef5685dc9 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/const-invalid-assignment-next-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2015 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 13.1 +description: > + const: invalid assignment in next expression +negative: TypeError +---*/ + +for (const i = 0; i < 1; i++) { } diff --git a/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js b/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js new file mode 100644 index 0000000000000000000000000000000000000000..c821ee92dd93527bea652a58ab87cc4e558c8f86 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/const-outer-inner-let-bindings.js @@ -0,0 +1,22 @@ +// Copyright (C) Copyright 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: > + outer const binding unchanged by for-loop const binding +---*/ +// + +const x = "outer_x"; +const y = "outer_y"; +var i = 0; + +for (const x = "inner_x"; i < 1; i++) { + const y = "inner_y"; + + assert.sameValue(x, "inner_x"); + assert.sameValue(y, "inner_y"); +} +assert.sameValue(x, "outer_x"); +assert.sameValue(y, "outer_y"); + diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js new file mode 100644 index 0000000000000000000000000000000000000000..3f24e5d776294563afa4a7ae365acd705cb4ed63 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-condition.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: closure inside for loop condition +---*/ +let a = []; +for (let i = 0; a.push(function () { return i; }), i < 5; ++i) { } +for (let k = 0; k < 5; ++k) { + assert.sameValue(k, a[k]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js new file mode 100644 index 0000000000000000000000000000000000000000..bc214fa53c922d6045232ff008b7846cbb7e1da7 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-initialization.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: closure inside for loop initialization +---*/ +let a = []; +for (let i = 0, f = function() { return i }; i < 5; ++i) { + a.push(f); +} +for (let k = 0; k < 5; ++k) { + assert.sameValue(0, a[k]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js b/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..dceb519278709f5a4ad53a441df85f7dc90b288c --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-closure-inside-next-expression.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: closure inside for loop next-expression +---*/ +let a = []; +for (let i = 0; i < 5; a.push(function () { return i; }), ++i) { } +for (let k = 0; k < 5; ++k) { + assert.sameValue(k + 1, a[k]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js new file mode 100644 index 0000000000000000000000000000000000000000..cdb2878a738cffb3ae014f91d804061a26e01e28 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-multi-let-binding.js @@ -0,0 +1,16 @@ +// Copyright (C) Copyright 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: > + In a normal for statement the iteration variable is freshly allocated for each iteration. Multi let binding +---*/ +let a = [], b = []; +for (let i = 0, j = 10; i < 5; ++i, ++j) { + a.push(function () { return i; }); + b.push(function () { return j; }); +} +for (let k = 0; k < 5; ++k) { + assert.sameValue(k, a[k]()); + assert.sameValue(k + 10, b[k]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js new file mode 100644 index 0000000000000000000000000000000000000000..4361dc2d90f104a48a0067d39cc9957343f8b38c --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-iteration-variable-is-freshly-allocated-for-each-iteration-single-let-binding.js @@ -0,0 +1,14 @@ +// Copyright (C) Copyright 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: > + In a normal for statement the iteration variable is freshly allocated for each iteration. Single let binding +---*/ +let a = []; +for (let i = 0; i < 5; ++i) { + a.push(function () { return i; }); +} +for (let j = 0; j < 5; ++j) { + assert.sameValue(j, a[j]()); +} diff --git a/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js b/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js new file mode 100644 index 0000000000000000000000000000000000000000..d8f50e2d31bc90d6b5628717f46a449a95c3f949 --- /dev/null +++ b/test/language/block-scope/syntax/for-loop/let-outer-inner-let-bindings.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + outer let binding unchanged by for-loop let binding +---*/ +// + +let x = "outer_x"; +let y = "outer_y"; + +for (let x = "inner_x", i = 0; i < 1; i++) { + let y = "inner_y"; + + assert.sameValue(x, "inner_x"); + assert.sameValue(y, "inner_y"); +} +assert.sameValue(x, "outer_x"); +assert.sameValue(y, "outer_y"); + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..679e1a1e31812260d29ca2c79ec4bb7d626fe93d --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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() {} } + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..11d289f667ba665ec628607e90d7583afa6d8eb6 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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() {} } + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..8f94a7f4d22b3a209085bcae9ed34bc416771126 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: + do Statement while ( Expression ) +negative: SyntaxError +flags: [onlyStrict] +---*/ +do function g() {} while (false) + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..325f757f1c5c5573f3470b0deb9506de91491004 --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: + for ( ;;) Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +for (;false;) function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..b4a0531768dc2ed71a7c2b246ebff508865d4edd --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: SyntaxError +flags: [onlyStrict] +---*/ +if (true) {} else function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..1eb4abd3038b84cdc4774c205f03263929ae1b4e --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: SyntaxError +flags: [onlyStrict] +---*/ +if (true) function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..32920ac6994f33049f9e6566187bcb8ab8bb7dbe --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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: + label: Statement +---*/ +label: function g() {} + diff --git a/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..e772de8702ed6b9466afa51beb83654c77e7b57d --- /dev/null +++ b/test/language/block-scope/syntax/function-declarations/in-statement-position-while-expression-statement.js @@ -0,0 +1,12 @@ +// Copyright (C) Copyright 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: + while ( Expression ) Statement +negative: SyntaxError +flags: [onlyStrict] +---*/ +while (false) function g() {} + diff --git a/test/language/block-scope/syntax/global-and-block/const.js b/test/language/block-scope/syntax/global-and-block/const.js new file mode 100644 index 0000000000000000000000000000000000000000..62a11ab4b1ecb0c09e66d1fb4d69453b1d59683f --- /dev/null +++ b/test/language/block-scope/syntax/global-and-block/const.js @@ -0,0 +1,21 @@ +// Copyright (C) Copyright 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: > + global and block scope const +---*/ +const z = 4; + +// Block local +{ + const z = 5; +} + +assert.sameValue(z, 4); + +if (true) { + const z = 1; + assert.sameValue(z, 1); +} + diff --git a/test/language/block-scope/syntax/global-and-block/let.js b/test/language/block-scope/syntax/global-and-block/let.js new file mode 100644 index 0000000000000000000000000000000000000000..e2a14600c33cc61ebaacdf64d122947ce795ad04 --- /dev/null +++ b/test/language/block-scope/syntax/global-and-block/let.js @@ -0,0 +1,24 @@ +// Copyright (C) Copyright 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: > + global and block scope let +---*/ +let x; +let y = 2; + +// Block local +{ + let y; + let x = 3; +} + +assert.sameValue(x, undefined); +assert.sameValue(y, 2); + +if (true) { + let y; + assert.sameValue(y, undefined); +} + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..0b5159173ae034620df818b561df7fcb803e84a4 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + case Expression : StatementList +---*/ +switch (true) { case true: let x = 1; } + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..2fea96e2f4480e4500f757dd7c04fcb4e92bdde8 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + default : StatementList +---*/ +switch (true) { default: let x = 1; } + diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..6434bad8cdc88c1c5b792dbd02a20e925e904201 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do let x = 1; while (false) diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..1a0b3d88c3dadeedfee1e49e5e2da8ec260320ea --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..344afe73a381b7857c40333fe491bd39ffc3482a --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..c4a8de67909e21b28a21ed69aa40190d82ba9d83 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..24db93dd35b76d3844550f081d48081fdce5022d --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..a12ae7092003cba40cca1bc6be04e6c8e5a3999c --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/with-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 with initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) let x = 1; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..215e05b09268e7010076d4e008f64a9adc67a4dd --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-case-expression-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + case Expression : StatementList +negative: SyntaxError +---*/ +switch (true) { case true: let x; } diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js new file mode 100644 index 0000000000000000000000000000000000000000..bccfe824f95ad917df5adc7e9d395edc784dc488 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-default-statement-list.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + default : StatementList +negative: SyntaxError +---*/ +switch (true) { default: let x; } diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js new file mode 100644 index 0000000000000000000000000000000000000000..43dec6bb72ac98a730d4da1a8c33cec13e9d0086 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-do-statement-while-expression.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + do Statement while ( Expression ) +negative: SyntaxError +---*/ +do let x; while (false) diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..36398e4084c275771db90c18593d754fe28d16dd --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-for-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + for ( ;;) Statement +negative: SyntaxError +---*/ +for (;false;) let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..2865f91586b990467abf12371af3f989f14845c4 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement-else-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + if ( Expression ) Statement else Statement +negative: SyntaxError +---*/ +if (true) {} else let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..9bd2e93d3b464487949adc8079a19b6d62183905 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-if-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + if ( Expression ) Statement +negative: SyntaxError +---*/ +if (true) let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..6bfd0b18a2d91aad09273064aecfa7f4735f0a15 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-label-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + label: Statement +negative: SyntaxError +---*/ +label: let x; diff --git a/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js new file mode 100644 index 0000000000000000000000000000000000000000..47ef3092fd10e7f10f8c232acfb154dfeb2ac832 --- /dev/null +++ b/test/language/block-scope/syntax/let-declarations/without-initialisers-in-statement-positions-while-expression-statement.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 without initialisers in statement positions: + while ( Expression ) Statement +negative: SyntaxError +---*/ +while (false) let x; diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..431b17916eeab836ca729fed562bb30005fd8ce4 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-declare-function-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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() {} + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..c51e54cca123b2732c414b2bc34c1a64dff4c6c6 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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 function declaration +---*/ +function f() {} function f() {} + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js new file mode 100644 index 0000000000000000000000000000000000000000..131b2c55e0512fbeed4f958141e7bd2aa4eb526c --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-function-declaration-with-var.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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; + diff --git a/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..4d3e618566bfc631b0220864cf096fa10020c174 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-global/allowed-to-redeclare-var-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 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() {} + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..e6020c6ec88a66678d81bc62fef7ebae2f2ea65c --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-function-declaration.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with function declaration +negative: SyntaxError +---*/ +{ function f() {} function f() {} } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js new file mode 100644 index 0000000000000000000000000000000000000000..d7341ab822d387a9f4bc0b6a5d58415b0ddc5d02 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-let.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with let +negative: SyntaxError +---*/ +{ function f() {} let f; } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js new file mode 100644 index 0000000000000000000000000000000000000000..fdd28f6b8dbbe69e0ee35b8839c8ef0ea6c2264b --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-function-declaration-with-var.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare function declaration with var +negative: SyntaxError +---*/ +{ function f() {} var f; } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..7c6cb7a9e4fffc01946a22a182390dcca0652c90 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-function-declaration.js @@ -0,0 +1,10 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare let binding with function declaration +negative: SyntaxError +---*/ +{ let f; function f() {} } diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js new file mode 100644 index 0000000000000000000000000000000000000000..1259da9bc437205e6bfe26a4594ea83f6095c510 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-let-binding-with-var.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare let binding with var +negative: SyntaxError +---*/ +{ let f; var f; } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js new file mode 100644 index 0000000000000000000000000000000000000000..6927a169338b1119ae82ec8a4925c9f5c4ceee68 --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-binding-with-let.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare var binding with let +negative: SyntaxError +---*/ +{ var f; let f; } + diff --git a/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js new file mode 100644 index 0000000000000000000000000000000000000000..4e374bf9087accd44627aa264d1f4e2c8157108c --- /dev/null +++ b/test/language/block-scope/syntax/redeclaration-in-block/attempt-to-redeclare-var-with-function-declaration.js @@ -0,0 +1,11 @@ +// Copyright (C) Copyright 2011 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: B.3.3 +description: > + redeclaration within block: + attempt to redeclare var with function declaration +negative: SyntaxError +---*/ +{ var f; function f() {} } +