fix hoist_funs on block-scoped function under "use strict" (#2013)
Technically not part of ES5, but commonly used code exists in the wild.
This commit is contained in:
@@ -2251,11 +2251,12 @@ merge(Compressor.prototype, {
|
||||
dirs.push(node);
|
||||
return make_node(AST_EmptyStatement, node);
|
||||
}
|
||||
if (node instanceof AST_Defun && hoist_funs) {
|
||||
if (hoist_funs && node instanceof AST_Defun
|
||||
&& (tt.parent() === self || !compressor.has_directive("use strict"))) {
|
||||
hoisted.push(node);
|
||||
return make_node(AST_EmptyStatement, node);
|
||||
}
|
||||
if (node instanceof AST_Var && hoist_vars) {
|
||||
if (hoist_vars && node instanceof AST_Var) {
|
||||
node.definitions.forEach(function(def){
|
||||
vars.set(def.name.name, def);
|
||||
++vars_found;
|
||||
|
||||
Reference in New Issue
Block a user