implement optional TDZ - fixes #563
This commit is contained in:
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/assignment.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/assignment.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
a = 1;
|
||||
|
||||
let a = 2;
|
||||
7
test/fixtures/transformation/es6-block-scoping-tdz-fail/call-2.js
vendored
Normal file
7
test/fixtures/transformation/es6-block-scoping-tdz-fail/call-2.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function b() {
|
||||
assert.equals(a, 1);
|
||||
}
|
||||
|
||||
let a = 1;
|
||||
|
||||
b();
|
||||
7
test/fixtures/transformation/es6-block-scoping-tdz-fail/call-3.js
vendored
Normal file
7
test/fixtures/transformation/es6-block-scoping-tdz-fail/call-3.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
function b() {
|
||||
assert.equals(a, 1);
|
||||
}
|
||||
|
||||
b();
|
||||
|
||||
let a = 1;
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/call.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/call.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
a;
|
||||
|
||||
let a = 1;
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/defaults.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/defaults.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function foo(bar = bar2, bar2) {}
|
||||
|
||||
foo();
|
||||
4
test/fixtures/transformation/es6-block-scoping-tdz-fail/options.json
vendored
Normal file
4
test/fixtures/transformation/es6-block-scoping-tdz-fail/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"optional": "es6.blockScopingTDZ",
|
||||
"throws": "is not defined - temporal dead zone"
|
||||
}
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/update.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-fail/update.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
a++;
|
||||
|
||||
let a = 1;
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/assignment.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/assignment.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let a = 1;
|
||||
a = 2;
|
||||
assert.equal(a, 2);
|
||||
7
test/fixtures/transformation/es6-block-scoping-tdz-pass/call.js
vendored
Normal file
7
test/fixtures/transformation/es6-block-scoping-tdz-pass/call.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
let a = 1;
|
||||
|
||||
function b() {
|
||||
return a + 1;
|
||||
}
|
||||
|
||||
assert.equal(b(), 2);
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/defaults.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/defaults.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function foo(bar, bar2 = bar) {}
|
||||
|
||||
foo();
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/options.json
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"optional": "es6.blockScopingTDZ"
|
||||
}
|
||||
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/update.js
vendored
Normal file
3
test/fixtures/transformation/es6-block-scoping-tdz-pass/update.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
let a = 1;
|
||||
a++;
|
||||
assert.equal(a, 2);
|
||||
@@ -1,2 +0,0 @@
|
||||
qux;
|
||||
let qux = 456;
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"throws": "Temporal dead zone - accessing a variable before it's initialized",
|
||||
"optional": ["es6.blockScopingTDZ"]
|
||||
}
|
||||
Reference in New Issue
Block a user