return node;
}
}
- var child, in_loop, scope;
+ var insert, in_loop, scope;
if (replacing && can_inject_symbols()) {
fn._squeezed = true;
if (exp !== fn) fn.parent_scope = exp.scope;
function can_inject_symbols() {
var defined = Object.create(null);
- var level = 0;
+ var level = 0, child;
scope = compressor.self();
while (!(scope instanceof AST_Scope)) {
if (scope.variables) scope.variables.each(function(def) {
if (scope.fixed_value() instanceof AST_Scope) return false;
}
}
+ insert = scope.body.indexOf(child) + 1;
+ if (!insert) return false;
var safe_to_inject = (!(scope instanceof AST_Toplevel) || compressor.toplevel.vars)
&& (exp !== fn || fn.parent_scope.resolve() === compressor.find_parent(AST_Scope));
var inline = compressor.option("inline");
return true;
}
});
- args.unshift(scope.body.indexOf(child) + 1, 0);
+ args.unshift(insert, 0);
if (decls.length) args.push(make_node(AST_Var, fn, {
definitions: decls
}));
}
expect_stdout: true
}
+
+issue_4265: {
+ options = {
+ conditionals: true,
+ dead_code: true,
+ inline: true,
+ sequences: true,
+ }
+ input: {
+ function f() {
+ console;
+ if ([ function() {
+ return this + console.log(a);
+ a;
+ var a;
+ }() ]);
+ return 0;
+ }
+ f();
+ }
+ expect: {
+ function f() {
+ return console, function() {
+ return console.log(a);
+ var a;
+ }(), 0;
+ }
+ f();
+ }
+ expect_stdout: "undefined"
+}