aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index c59dc0a7..0c35b0dd 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -512,6 +512,7 @@ function _default_mangler_options(options) {
keep_fnames : false,
reserved : [],
toplevel : false,
+ v8 : false,
webkit : false,
});
if (!Array.isArray(options.reserved)) options.reserved = [];
@@ -543,7 +544,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
// lname is incremented when we get to the AST_Label
var save_nesting = lname;
descend();
- lname = save_nesting;
+ if (!options.v8 || !in_label(tw)) lname = save_nesting;
return true;
}
if (node instanceof AST_BlockScope) {
@@ -616,6 +617,14 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
sym.thedef = def;
}
}
+
+ function in_label(tw) {
+ var level = 0, parent;
+ while (parent = tw.parent(level++)) {
+ if (parent instanceof AST_Block) return parent instanceof AST_Toplevel && !options.toplevel;
+ if (parent instanceof AST_LabeledStatement) return true;
+ }
+ }
});
AST_Toplevel.DEFMETHOD("find_colliding_names", function(options) {