support let (#4227)

This commit is contained in:
Alex Lam S.L
2020-10-19 01:32:39 +01:00
committed by GitHub
parent 6c7226c10e
commit 96bf7fceab
10 changed files with 1186 additions and 152 deletions

View File

@@ -161,31 +161,6 @@ merge_vars_3: {
expect_stdout: true
}
reduce_merge_vars: {
options = {
merge_vars: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
const a = console;
console.log(typeof a);
var b = typeof a;
console.log(b);
}
expect: {
var b = console;
console.log(typeof b);
b = typeof b;
console.log(b);
}
expect_stdout: [
"object",
"object",
]
}
use_before_init_1: {
options = {
reduce_vars: true,
@@ -312,24 +287,6 @@ reduce_block_1: {
expect_stdout: "object"
}
reduce_block_1_toplevel: {
options = {
reduce_vars: true,
toplevel: true,
}
input: {
{
const a = typeof console;
console.log(a);
}
}
expect: {
var a = typeof console;
console.log(a);
}
expect_stdout: "object"
}
reduce_block_2: {
options = {
reduce_vars: true,
@@ -373,7 +330,7 @@ reduce_block_2_toplevel: {
expect_stdout: true
}
hoist_props_1: {
hoist_props: {
options = {
hoist_props: true,
reduce_vars: true,
@@ -397,28 +354,6 @@ hoist_props_1: {
expect_stdout: "PASS"
}
hoist_props_2: {
options = {
hoist_props: true,
passes: 2,
reduce_vars: true,
toplevel: true,
}
input: {
{
const o = {
p: "PASS",
};
console.log(o.p);
}
}
expect: {
var o_p = "PASS";
console.log(o_p);
}
expect_stdout: "PASS"
}
loop_block_1: {
options = {
loops: true,
@@ -559,29 +494,6 @@ dead_block_after_return: {
expect_stdout: true
}
const_to_var_scope_adjustment: {
options = {
conditionals: true,
inline: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
for (var k in [ 42 ])
console.log(function f() {
if (k) {
const a = 0;
}
}());
}
expect: {
for (var k in [ 42 ])
console.log(void (k && 0));
}
expect_stdout: "undefined"
}
do_if_continue_1: {
options = {
if_return: true,
@@ -687,7 +599,7 @@ legacy_scope: {
expect_stdout: true
}
issue_4191_1: {
issue_4191: {
options = {
functions: true,
reduce_vars: true,
@@ -708,24 +620,6 @@ issue_4191_1: {
expect_stdout: true
}
issue_4191_2: {
options = {
functions: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
const a = function() {};
console.log(typeof a, a());
}
expect: {
function a() {};
console.log(typeof a, a());
}
expect_stdout: "function undefined"
}
issue_4193: {
options = {
dead_code: true,