add comments for #1602
This commit is contained in:
parent
3787fc1570
commit
200090a38d
|
|
@ -151,7 +151,17 @@ merge(Compressor.prototype, {
|
|||
node = node.hoist_declarations(this);
|
||||
was_scope = true;
|
||||
}
|
||||
// Before https://github.com/mishoo/UglifyJS2/pull/1602 AST_Node.optimize()
|
||||
// would call AST_Node.transform() if a different instance of AST_Node is
|
||||
// produced after OPT().
|
||||
// This corrupts TreeWalker.stack, which cause AST look-ups to malfunction.
|
||||
// Migrate and defer all children's AST_Node.transform() to below, which
|
||||
// will now happen after this parent AST_Node has been properly substituted
|
||||
// thus gives a consistent AST snapshot.
|
||||
descend(node, this);
|
||||
// Existing code relies on how AST_Node.optimize() worked, and omitting the
|
||||
// following replacement call would result in degraded efficiency of both
|
||||
// output and performance.
|
||||
descend(node, this);
|
||||
var opt = node.optimize(this);
|
||||
if (was_scope && opt instanceof AST_Scope) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user