diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-04-17 16:19:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-17 16:19:08 +0800 |
commit | 21cd7e3f571030c889619b39287ac8420044bcc4 (patch) | |
tree | 03c3730f47e0cc28fac5d37b46246f27d35763dc | |
parent | 5172ba5f2ade22716e65ff2333218fc08996bfcc (diff) | |
download | tracifyjs-21cd7e3f571030c889619b39287ac8420044bcc4.tar.gz tracifyjs-21cd7e3f571030c889619b39287ac8420044bcc4.zip |
reduce test exports (#3361)
-rw-r--r-- | lib/parse.js | 4 | ||||
-rw-r--r-- | lib/scope.js | 6 | ||||
-rw-r--r-- | test/exports.js | 3 |
3 files changed, 3 insertions, 10 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; } diff --git a/test/exports.js b/test/exports.js index 85a3c3bf..65a7362f 100644 --- a/test/exports.js +++ b/test/exports.js @@ -1,7 +1,5 @@ -exports["base54"] = base54; exports["Compressor"] = Compressor; exports["defaults"] = defaults; -exports["is_identifier"] = is_identifier; exports["JS_Parse_Error"] = JS_Parse_Error; exports["mangle_properties"] = mangle_properties; exports["minify"] = minify; @@ -9,7 +7,6 @@ exports["OutputStream"] = OutputStream; exports["parse"] = parse; exports["push_uniq"] = push_uniq; exports["reserve_quoted_keys"] = reserve_quoted_keys; -exports["SourceMap"] = SourceMap; exports["string_template"] = string_template; exports["tokenizer"] = tokenizer; exports["TreeTransformer"] = TreeTransformer; |