OPT(AST_Object, function(self, compressor) {
if (!compressor.option("objects") || compressor.has_directive("use strict")) return self;
+ for (var i = self.properties.length; --i >= 0;) {
+ var prop = self.properties[i];
+ var key = prop.key;
+ if (key instanceof AST_Node) key = key.evaluate(compressor);
+ if (typeof key != "string" || /[0-9]+/.test(key)) break;
+ if (key !== prop.key) prop.key = "" + key;
+ }
var keys = new Dictionary();
var values = [];
self.properties.forEach(function(prop) {
- if (prop.key instanceof AST_Node) {
- var key = prop.key.evaluate(compressor);
- if (key !== prop.key) prop.key = "" + key;
- }
if (prop instanceof AST_ObjectKeyVal && typeof prop.key == "string") {
if (prop.value.has_side_effects(compressor)) flush();
keys.add(prop.key, prop.value);