@@ -51,7 +51,6 @@ function SymbolDef(scope, index, orig) {
|
|||||||
this.global = false;
|
this.global = false;
|
||||||
this.export = false;
|
this.export = false;
|
||||||
this.mangled_name = null;
|
this.mangled_name = null;
|
||||||
this.object_destructuring_arg = false;
|
|
||||||
this.undeclared = false;
|
this.undeclared = false;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.id = SymbolDef.next_id++;
|
this.id = SymbolDef.next_id++;
|
||||||
@@ -65,7 +64,6 @@ SymbolDef.prototype = {
|
|||||||
|
|
||||||
return (this.global && !options.toplevel)
|
return (this.global && !options.toplevel)
|
||||||
|| this.export
|
|| this.export
|
||||||
|| this.object_destructuring_arg
|
|
||||||
|| this.undeclared
|
|| this.undeclared
|
||||||
|| (!options.eval && (this.scope.uses_eval || this.scope.uses_with))
|
|| (!options.eval && (this.scope.uses_eval || this.scope.uses_with))
|
||||||
|| (options.keep_fnames
|
|| (options.keep_fnames
|
||||||
@@ -168,9 +166,6 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
|
|||||||
if (node instanceof AST_Symbol) {
|
if (node instanceof AST_Symbol) {
|
||||||
node.scope = scope;
|
node.scope = scope;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_SymbolFunarg) {
|
|
||||||
node.object_destructuring_arg = !!in_destructuring;
|
|
||||||
}
|
|
||||||
if (node instanceof AST_Label) {
|
if (node instanceof AST_Label) {
|
||||||
node.thedef = node;
|
node.thedef = node;
|
||||||
node.references = [];
|
node.references = [];
|
||||||
@@ -378,7 +373,6 @@ AST_Scope.DEFMETHOD("def_variable", function(symbol){
|
|||||||
if (!this.variables.has(symbol.name)) {
|
if (!this.variables.has(symbol.name)) {
|
||||||
def = new SymbolDef(this, this.variables.size(), symbol);
|
def = new SymbolDef(this, this.variables.size(), symbol);
|
||||||
this.variables.set(symbol.name, def);
|
this.variables.set(symbol.name, def);
|
||||||
def.object_destructuring_arg = symbol.object_destructuring_arg;
|
|
||||||
def.global = !this.parent_scope;
|
def.global = !this.parent_scope;
|
||||||
} else {
|
} else {
|
||||||
def = this.variables.get(symbol.name);
|
def = this.variables.get(symbol.name);
|
||||||
|
|||||||
@@ -562,9 +562,8 @@ anon_func_with_destructuring_args: {
|
|||||||
})({bar: 5 - 0}, [, 6]);
|
})({bar: 5 - 0}, [, 6]);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
(function({foo: foo = 1, bar: bar = 2}, [o = 3, a = 4]){
|
(function({foo: o = 1, bar: n = 2}, [a = 3, b = 4]) {
|
||||||
// FIXME: `foo` and `bar` should be mangled
|
console.log(o, n, a, b);
|
||||||
console.log(foo, bar, o, a)
|
|
||||||
})({bar: 5}, [, 6]);
|
})({bar: 5}, [, 6]);
|
||||||
}
|
}
|
||||||
expect_stdout: "1 5 3 6"
|
expect_stdout: "1 5 3 6"
|
||||||
@@ -589,9 +588,8 @@ arrow_func_with_destructuring_args: {
|
|||||||
})({bar: 5 - 0}, [, 6]);
|
})({bar: 5 - 0}, [, 6]);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
(({foo: foo = 1, bar: bar = 2},[o = 3, a = 4]) => {
|
(({foo: o = 1, bar: n = 2}, [a = 3, b = 4]) => {
|
||||||
// FIXME: `foo` and `bar` should be mangled
|
console.log(o, n, a, b);
|
||||||
console.log(foo, bar, o, a)
|
|
||||||
})({bar: 5}, [, 6]);
|
})({bar: 5}, [, 6]);
|
||||||
}
|
}
|
||||||
expect_stdout: "1 5 3 6"
|
expect_stdout: "1 5 3 6"
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ compress_new_function_with_destruct: {
|
|||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
Function("a", "[b]", "return a");
|
Function("a", "[b]", "return a");
|
||||||
Function("a", "{bb}", "return a");
|
Function("a", "{bb:b}", "return a");
|
||||||
Function("[[a]]", "[{bb}]", 'return a');
|
Function("[[a]]", "[{bb:b}]", 'return a');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user