diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/parse.js | 4 | ||||
-rw-r--r-- | lib/scope.js | 6 |
2 files changed, 3 insertions, 7 deletions
diff --git a/lib/parse.js b/lib/parse.js index f7c5d11b..1a373a18 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -164,10 +164,6 @@ function is_unicode_connector_punctuation(ch) { return UNICODE.connector_punctuation.test(ch); } -function is_identifier(name) { - return !RESERVED_WORDS[name] && /^[a-z_$][a-z0-9_$]*$/i.test(name); -} - function is_identifier_start(code) { return code == 36 || code == 95 || is_letter(code); } diff --git a/lib/scope.js b/lib/scope.js index b6bfe1a8..47e05da2 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -342,7 +342,7 @@ function next_mangled_name(scope, options, def) { } while (true) { name = base54(++scope.cname); - if (in_use[name] || !is_identifier(name) || options.reserved.has[name]) continue; + if (in_use[name] || RESERVED_WORDS[name] || options.reserved.has[name]) continue; if (!names[name]) break; holes.push(scope.cname); } @@ -422,7 +422,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options) { var name; do { name = base54(++lname); - } while (!is_identifier(name)); + } while (RESERVED_WORDS[name]); node.mangled_name = name; return true; } @@ -493,7 +493,7 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { var name; do { name = base54(cname++); - } while (avoid[name] || !is_identifier(name)); + } while (avoid[name] || RESERVED_WORDS[name]); return name; } |