@@ -996,9 +996,7 @@ merge(Compressor.prototype, {
|
||||
|
||||
function needs_unbinding(compressor, val) {
|
||||
return val instanceof AST_PropAccess
|
||||
|| compressor.has_directive("use strict")
|
||||
&& is_undeclared_ref(val)
|
||||
&& val.name == "eval";
|
||||
|| is_undeclared_ref(val) && val.name == "eval";
|
||||
}
|
||||
|
||||
// we shouldn't compress (1,func)(something) to
|
||||
|
||||
15
lib/scope.js
15
lib/scope.js
@@ -162,17 +162,22 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
|
||||
}
|
||||
if (node instanceof AST_SymbolRef) {
|
||||
var name = node.name;
|
||||
if (name == "eval" && tw.parent() instanceof AST_Call) {
|
||||
for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) {
|
||||
s.uses_eval = true;
|
||||
}
|
||||
}
|
||||
var sym = node.scope.find_variable(name);
|
||||
if (!sym) {
|
||||
sym = self.def_global(node);
|
||||
} else if (sym.scope instanceof AST_Lambda && name == "arguments") {
|
||||
sym.scope.uses_arguments = true;
|
||||
}
|
||||
if (name == "eval") {
|
||||
var parent = tw.parent();
|
||||
if (parent.TYPE == "Call" && parent.expression === node) {
|
||||
for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope) {
|
||||
s.uses_eval = true;
|
||||
}
|
||||
} else if (sym.undeclared) {
|
||||
self.uses_eval = true;
|
||||
}
|
||||
}
|
||||
node.thedef = sym;
|
||||
node.reference(options);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user