aboutsummaryrefslogtreecommitdiff
path: root/tools/eliminator/node_modules/uglify-js
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-08-23 06:08:01 +0300
committermax99x <max99x@gmail.com>2011-08-23 06:08:19 +0300
commit536bad16ce88bad71fe94af285f9a9d2f721b2ad (patch)
treee6b5b8935b973819117c40ee1001e82120962d36 /tools/eliminator/node_modules/uglify-js
parent9cf10ae755d5ef32d558d945c25464e1ba564738 (diff)
Updated UglifyJS to preserve object key quotedness (Closure Compiler compatibility).
Diffstat (limited to 'tools/eliminator/node_modules/uglify-js')
-rw-r--r--tools/eliminator/node_modules/uglify-js/lib/parse-js.js28
-rw-r--r--tools/eliminator/node_modules/uglify-js/lib/process.js2
2 files changed, 17 insertions, 13 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":
diff --git a/tools/eliminator/node_modules/uglify-js/lib/process.js b/tools/eliminator/node_modules/uglify-js/lib/process.js
index d34e2394..85709857 100644
--- a/tools/eliminator/node_modules/uglify-js/lib/process.js
+++ b/tools/eliminator/node_modules/uglify-js/lib/process.js
@@ -1673,7 +1673,7 @@ function gen_code(ast, options) {
return indent(make_function(p[0], p[1][2], p[1][3], p[2]));
}
var key = p[0], val = parenthesize(p[1], "seq");
- if (options.quote_keys) {
+ if (options.quote_keys || p.quoted) {
key = encode_string(key);
} else if ((typeof key == "number" || !beautify && +key + "" == key)
&& parseFloat(key) >= 0) {