Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/ClosureJsBackend.java

Issue 8252006: Enabled class name minification in production mode. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/backend/js/ClosureJsBackend.java
===================================================================
--- compiler/java/com/google/dart/compiler/backend/js/ClosureJsBackend.java (revision 369)
+++ compiler/java/com/google/dart/compiler/backend/js/ClosureJsBackend.java (working copy)
@@ -82,28 +82,33 @@
// Validate the generated JavaScript
private final boolean validate;
+ // Whether the generated code is "checked".
+ private final boolean checkedMode;
+
public ClosureJsBackend() {
- this(false);
+ this(false, false);
}
/**
* @param generateHumanReadableOutput - generates human readable javascript output.
*/
- public ClosureJsBackend(boolean generateHumanReadableOutput) {
+ public ClosureJsBackend(boolean checkedMode, boolean generateHumanReadableOutput) {
// Current default settings
- this(false, true, false, true, generateHumanReadableOutput);
+ this(false, true, false, true, checkedMode, generateHumanReadableOutput);
}
public ClosureJsBackend(boolean fastOutput,
boolean produceSourceMap,
boolean incremental,
boolean validate,
+ boolean checkedMode,
boolean generateHumanReadableOutput) {
this.fastOutput = fastOutput;
this.produceSourceMap = produceSourceMap;
// can't currently produce a valid source map incrementally
this.incremental = incremental && !produceSourceMap;
this.validate = validate;
+ this.checkedMode = checkedMode;
this.generateHumanReadableOutput = generateHumanReadableOutput;
}
@@ -487,9 +492,11 @@
/*
* NOTE: We turn this off because TypeErrors or anything that relies on a type name will fail
- * due to the renaming.
+ * due to the class renaming.
*/
- options.setReplaceIdGenerators(false);
+ if (checkedMode) {
+ options.setReplaceIdGenerators(false);
+ }
return options;
}
@@ -576,7 +583,7 @@
* @return a mutable list
* @throws IOException
*/
- public static List<JSSourceFile> getDefaultExterns() throws IOException {
+ private static List<JSSourceFile> getDefaultExterns() throws IOException {
Class<ClosureJsBackend> clazz = ClosureJsBackend.class;
InputStream input = clazz.getResourceAsStream(
"/com/google/javascript/jscomp/externs.zip");

Powered by Google App Engine
This is Rietveld 408576698