11
lib/scope.js
11
lib/scope.js
@@ -622,14 +622,10 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
|
|||||||
var lname = -1;
|
var lname = -1;
|
||||||
var redefined = [];
|
var redefined = [];
|
||||||
var tw = new TreeWalker(function(node, descend) {
|
var tw = new TreeWalker(function(node, descend) {
|
||||||
if (node instanceof AST_LabeledStatement) {
|
var save_nesting;
|
||||||
// `lname` is incremented when we get to the `AST_Label`
|
|
||||||
var save_nesting = lname;
|
|
||||||
descend();
|
|
||||||
if (!options.v8 || !in_label(tw)) lname = save_nesting;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (node instanceof AST_BlockScope) {
|
if (node instanceof AST_BlockScope) {
|
||||||
|
// `lname` is incremented when we get to the `AST_Label`
|
||||||
|
if (node instanceof AST_LabeledStatement) save_nesting = lname;
|
||||||
if (options.webkit && node instanceof AST_IterationStatement && node.init instanceof AST_Let) {
|
if (options.webkit && node instanceof AST_IterationStatement && node.init instanceof AST_Let) {
|
||||||
node.init.definitions.forEach(function(defn) {
|
node.init.definitions.forEach(function(defn) {
|
||||||
defn.name.match_symbol(function(sym) {
|
defn.name.match_symbol(function(sym) {
|
||||||
@@ -675,6 +671,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
to_mangle.forEach(mangle);
|
to_mangle.forEach(mangle);
|
||||||
|
if (node instanceof AST_LabeledStatement && !(options.v8 && in_label(tw))) lname = save_nesting;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Label) {
|
if (node instanceof AST_Label) {
|
||||||
|
|||||||
@@ -2427,80 +2427,6 @@ issue_5023_2: {
|
|||||||
node_version: ">=8"
|
node_version: ">=8"
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_5032_normal: {
|
|
||||||
options = {
|
|
||||||
merge_vars: true,
|
|
||||||
webkit: false,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async function f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS");
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async function f(a) {
|
|
||||||
var a = log(a), c = a;
|
|
||||||
log(a);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS");
|
|
||||||
}
|
|
||||||
expect_stdout: [
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
]
|
|
||||||
node_version: ">=8"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_5032_webkit: {
|
|
||||||
options = {
|
|
||||||
merge_vars: true,
|
|
||||||
webkit: true,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async function f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS");
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
async function f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS");
|
|
||||||
}
|
|
||||||
expect_stdout: [
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
]
|
|
||||||
node_version: ">=8"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_5034: {
|
issue_5034: {
|
||||||
options = {
|
options = {
|
||||||
functions: true,
|
functions: true,
|
||||||
|
|||||||
@@ -1604,48 +1604,6 @@ issue_4305_2: {
|
|||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_1753: {
|
|
||||||
mangle = {
|
|
||||||
toplevel: false,
|
|
||||||
webkit: true,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
"use strict";
|
|
||||||
let l = null;
|
|
||||||
for (let i = 0; i < 1; i++)
|
|
||||||
console.log(i);
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
"use strict";
|
|
||||||
let l = null;
|
|
||||||
for (let i = 0; i < 1; i++)
|
|
||||||
console.log(i);
|
|
||||||
}
|
|
||||||
expect_stdout: "0"
|
|
||||||
node_version: ">=4"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_1753_toplevel: {
|
|
||||||
mangle = {
|
|
||||||
toplevel: true,
|
|
||||||
webkit: true,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
"use strict";
|
|
||||||
let l = null;
|
|
||||||
for (let i = 0; i < 1; i++)
|
|
||||||
console.log(i);
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
"use strict";
|
|
||||||
let l = null;
|
|
||||||
for (let e = 0; e < 1; e++)
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
expect_stdout: "0"
|
|
||||||
node_version: ">=4"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_4438: {
|
issue_4438: {
|
||||||
options = {
|
options = {
|
||||||
if_return: true,
|
if_return: true,
|
||||||
|
|||||||
@@ -107,3 +107,209 @@ function_name_mangle_ie8: {
|
|||||||
expect_exact: "(function(){console.log(typeof function n(o){})})();"
|
expect_exact: "(function(){console.log(typeof function n(o){})})();"
|
||||||
expect_stdout: "function"
|
expect_stdout: "function"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_1753: {
|
||||||
|
mangle = {
|
||||||
|
toplevel: false,
|
||||||
|
webkit: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
"use strict";
|
||||||
|
let l = null;
|
||||||
|
for (let i = 0; i < 1; i++)
|
||||||
|
console.log(i);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
"use strict";
|
||||||
|
let l = null;
|
||||||
|
for (let i = 0; i < 1; i++)
|
||||||
|
console.log(i);
|
||||||
|
}
|
||||||
|
expect_stdout: "0"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_1753_toplevel: {
|
||||||
|
mangle = {
|
||||||
|
toplevel: true,
|
||||||
|
webkit: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
"use strict";
|
||||||
|
let l = null;
|
||||||
|
for (let i = 0; i < 1; i++)
|
||||||
|
console.log(i);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
"use strict";
|
||||||
|
let l = null;
|
||||||
|
for (let e = 0; e < 1; e++)
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
expect_stdout: "0"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5032_await: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
webkit: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
async function f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
async function f(a) {
|
||||||
|
var a = log(a), c = a;
|
||||||
|
log(a);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
]
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5032_await_webkit: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
webkit: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
async function f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
async function f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
]
|
||||||
|
node_version: ">=8"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5032_yield: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
webkit: false,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
function *f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS").next();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
function *f(a) {
|
||||||
|
var a = log(a), c = a;
|
||||||
|
log(a);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS").next();
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
]
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5032_yield_webkit: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
webkit: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
function *f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS").next();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function log(value) {
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
function *f(a) {
|
||||||
|
var b = log(a), c = b;
|
||||||
|
log(b);
|
||||||
|
log(c);
|
||||||
|
}
|
||||||
|
f("PASS").next();
|
||||||
|
}
|
||||||
|
expect_stdout: [
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
"PASS",
|
||||||
|
]
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5480: {
|
||||||
|
mangle = {
|
||||||
|
webkit: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
"use strict";
|
||||||
|
L: for (let a in console.log("PASS"));
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
"use strict";
|
||||||
|
o: for (let o in console.log("PASS"));
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1267,80 +1267,6 @@ issue_5019_2: {
|
|||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
}
|
}
|
||||||
|
|
||||||
issue_5032_normal: {
|
|
||||||
options = {
|
|
||||||
merge_vars: true,
|
|
||||||
webkit: false,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
function *f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS").next();
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
function *f(a) {
|
|
||||||
var a = log(a), c = a;
|
|
||||||
log(a);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS").next();
|
|
||||||
}
|
|
||||||
expect_stdout: [
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
]
|
|
||||||
node_version: ">=4"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_5032_webkit: {
|
|
||||||
options = {
|
|
||||||
merge_vars: true,
|
|
||||||
webkit: true,
|
|
||||||
}
|
|
||||||
input: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
function *f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS").next();
|
|
||||||
}
|
|
||||||
expect: {
|
|
||||||
function log(value) {
|
|
||||||
console.log(value);
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
function *f(a) {
|
|
||||||
var b = log(a), c = b;
|
|
||||||
log(b);
|
|
||||||
log(c);
|
|
||||||
}
|
|
||||||
f("PASS").next();
|
|
||||||
}
|
|
||||||
expect_stdout: [
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
"PASS",
|
|
||||||
]
|
|
||||||
node_version: ">=4"
|
|
||||||
}
|
|
||||||
|
|
||||||
issue_5034: {
|
issue_5034: {
|
||||||
options = {
|
options = {
|
||||||
functions: true,
|
functions: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user