diff options
author | max99x <max99x@gmail.com> | 2011-08-23 06:08:01 +0300 |
---|---|---|
committer | max99x <max99x@gmail.com> | 2011-08-23 06:08:19 +0300 |
commit | 536bad16ce88bad71fe94af285f9a9d2f721b2ad (patch) | |
tree | e6b5b8935b973819117c40ee1001e82120962d36 /tools/eliminator/node_modules/uglify-js/lib/parse-js.js | |
parent | 9cf10ae755d5ef32d558d945c25464e1ba564738 (diff) |
Updated UglifyJS to preserve object key quotedness (Closure Compiler compatibility).
Diffstat (limited to 'tools/eliminator/node_modules/uglify-js/lib/parse-js.js')
-rw-r--r-- | tools/eliminator/node_modules/uglify-js/lib/parse-js.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tools/eliminator/node_modules/uglify-js/lib/parse-js.js b/tools/eliminator/node_modules/uglify-js/lib/parse-js.js index 69abf6c6..a89163c6 100644 --- a/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +++ b/tools/eliminator/node_modules/uglify-js/lib/parse-js.js @@ -1129,27 +1129,31 @@ function parse($TEXT, exigent_mode, embed_tokens) { // allow trailing comma break; var type = S.token.type; - var name = as_property_name(); + var name; + var is_quoted = false; + switch (S.token.type) { + case "string": + is_quoted = true; + case "num": + name = prog1(S.token.value, next); + break; + default: + name = as_name() + } + var node; if (type == "name" && (name == "get" || name == "set") && !is("punc", ":")) { - a.push([ as_name(), function_(false), name ]); + node = [ as_name(), function_(false), name ]; } else { expect(":"); - a.push([ name, expression(false) ]); + node = [ name, expression(false) ]; } + if (is_quoted) node.quoted = true; + a.push(node); } next(); return as("object", a); }; - function as_property_name() { - switch (S.token.type) { - case "num": - case "string": - return prog1(S.token.value, next); - } - return as_name(); - }; - function as_name() { switch (S.token.type) { case "name": |