cripple scope to make IE happy :-(
authorMihai Bazon <mihai@bazon.net>
Thu, 25 Oct 2012 15:52:35 +0000 (18:52 +0300)
committerMihai Bazon <mihai@bazon.net>
Thu, 25 Oct 2012 15:52:35 +0000 (18:52 +0300)
close #24

lib/scope.js

index d87a54d..910ce5a 100644 (file)
@@ -115,7 +115,14 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(){
             node.init_scope_vars();
         }
         if (node instanceof AST_SymbolLambda) {
-            scope.def_function(node);
+            //scope.def_function(node);
+            //
+            // https://github.com/mishoo/UglifyJS2/issues/24 — MSIE
+            // leaks function expression names into the containing
+            // scope.  Don't like this fix but seems we can't do any
+            // better.  IE: please die. Please!
+            (node.scope = scope.parent_scope).def_function(node);
+
             node.init.push(tw.parent());
         }
         else if (node instanceof AST_SymbolDefun) {