Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Add a new --globals option to pre-declare global variables; e…

….g., "YUI""

This reverts commit d27f3ad.
More info: http://yuilibrary.com/projects/yuicompressor/ticket/2528054
  • Loading branch information...
commit c3b3a551bf66626f0a32b5f4a94828c8047826a3 1 parent d27f3ad
@reid reid authored
View
8 src/com/yahoo/platform/yui/compressor/JavaScriptCompressor.java
@@ -526,17 +526,11 @@ private static void optimizeObjLitMemberDecl(ArrayList tokens) {
private ScriptOrFnScope globalScope = new ScriptOrFnScope(-1, null);
private Hashtable indexedScopes = new Hashtable();
- public JavaScriptCompressor(String[] globals, Reader in, ErrorReporter reporter)
+ public JavaScriptCompressor(Reader in, ErrorReporter reporter)
throws IOException, EvaluatorException {
this.logger = reporter;
this.tokens = parse(in, reporter);
- for (int ii = 0; ii < globals.length; ii++) {
- String symbol = globals[ii];
- if (symbol.length() <= 3) {
- globalScope.declareIdentifier(symbol);
- }
- }
}
public void compress(Writer out, int linebreak, boolean munge, boolean verbose,
View
7 src/com/yahoo/platform/yui/compressor/YUICompressor.java
@@ -24,7 +24,6 @@ public static void main(String args[]) {
CmdLineParser.Option verboseOpt = parser.addBooleanOption('v', "verbose");
CmdLineParser.Option nomungeOpt = parser.addBooleanOption("nomunge");
CmdLineParser.Option linebreakOpt = parser.addStringOption("line-break");
- CmdLineParser.Option globalsOpt = parser.addStringOption("globals");
CmdLineParser.Option preserveSemiOpt = parser.addBooleanOption("preserve-semi");
CmdLineParser.Option disableOptimizationsOpt = parser.addBooleanOption("disable-optimizations");
CmdLineParser.Option helpOpt = parser.addBooleanOption('h', "help");
@@ -73,10 +72,6 @@ public static void main(String args[]) {
}
}
- String globalsStr = (String) parser.getOptionValue(globalsOpt);
- String[] globals = globalsStr != null ?
- globalsStr.split(",") : new String[0];
-
String type = (String) parser.getOptionValue(typeOpt);
if (type != null && !type.equalsIgnoreCase("js") && !type.equalsIgnoreCase("css")) {
usage();
@@ -129,7 +124,7 @@ public static void main(String args[]) {
try {
- JavaScriptCompressor compressor = new JavaScriptCompressor(globals, in, new ErrorReporter() {
+ JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {
public void warning(String message, String sourceName,
int line, String lineSource, int lineOffset) {
Please sign in to comment.
Something went wrong with that request. Please try again.