braceN : -1,
parent : false,
subScopes : false,
- identifiers : false,
+ identifiers : false, // map of identifiers to {Identifier} objects
hints: false,
mungeM : true,
ident: '',
return result;
},
/** - we need to register short vairalbes so they never get munged into.. */
- addToParentScope: function(ident) {
+ addToParentScope: function(ident)
+ {
if (ident.length > 2) {
return;
}
}
},
- isProtectedVar: function(ident) {
+ isProtectedVar: function(ident)
+ {
if (ident.length > 2) {
return false;
}
return false;
},
-
+ /**
+ * set's all the munged values on the identifiers.
+ *
+ *
+ */
- munge :function() {
+ munge :function()
+ {
if (!this.mungeM) {
// Stop right here if this scope was flagged as unsafe for munging.
}
- //println("MUNGE: Scope:" + this.id+"</BR>");
+
var pickFromSet = 1;
// Do not munge symbols in the global scope!
if (this.parent) {
-
+
+ var all = [];
+ for (var i in this.identifiers) {
+ all.push(i);
+ }
+ print("MUNGE: " + all.join(', '));
//println("MUNGE: Building FreeSyms:" + this.id+"</BR>");
freeSymbols.push(batch[i]);
}
}
- /*
- var exsymbols = function(n) {
- if (sy.indexOf(n) > -1) {
- return;
- }
- freeSymbols.push(n);
- }
- */
- addSyms(JSDOC.Scope.ones);
-
- //if (freeSymbols.length == 0) {
- // pickFromSet = 2;
- // JSDOC.Scope.twos.filter(exsymbols);
-
- //}
- //if (freeSymbols.length == 0) {
- // pickFromSet = 3;
- // throw "disabled threes!"
- // JSDOC.Scope.threes.filter(exsymbols);
- //
- //}
- //if (freeSymbols.length == 0) {
- // throw "The Compressor ran out of symbols. Aborting...???? ";
- // }
+
+ addSyms(Scope.ones);
+
var repsym = '';
//println(freeSymbols.toSource());
if (!this.identifiers[i].toMunge) {
+ print("SKIP toMunge==false : " + i)
continue;
}
if (this.isProtectedVar(i)) {
+ print("SKIP PROTECTED: " + i)
continue; //
}
- if (this.identifiers[i].constructor != JSDOC.Identifier) {
- continue;
- }
+ //if (this.identifiers[i].constructor != Identifier) {
+ // print("SKIP NOT IDENTIFIER : " + i)
+ // continue;
+ // }
// println("IDENT:" +i+'</BR>');
if (!repsym.length) {
//println([ repsym,mungedValue ]);
if (this.mungeM && repsym.length < mungedValue.length) {
- //println("REPLACE:"+ mungedValue +" with " + repsym + "<BR>");
+ print("REPLACE:"+ mungedValue +" with " + repsym );
mungedValue = repsym;
repsym = '';
}
+
identifier.mungedValue = mungedValue;
}
//println("MUNGE: Done " + this.id+"</BR>");
}
-});
+};