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

Unified Diff: client/fling/src/java/core/com/google/dart/CompileService.java

Issue 8361026: Add checked mode option to CompileService. (Closed) Base URL: https://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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/fling/src/java/core/com/google/dart/CompileService.java
diff --git a/client/fling/src/java/core/com/google/dart/CompileService.java b/client/fling/src/java/core/com/google/dart/CompileService.java
index 6aff85b0e4eecebaa078ea2767642314244c5714..fb888910b0047df70e6c18abc77bbab49ad26fa6 100644
--- a/client/fling/src/java/core/com/google/dart/CompileService.java
+++ b/client/fling/src/java/core/com/google/dart/CompileService.java
@@ -166,14 +166,22 @@ public class CompileService {
private final static String FAKE_NAME = "tator";
public static CompileService create() {
- final CompilerConfiguration config = config(true);
+ return create(false);
pdr 2011/10/21 14:35:31 Why not true?
Kelly Norton 2011/10/21 15:55:27 Preserving the current behavior for now.
+ }
+
+ public static CompileService create(LibrarySource lib) {
+ return create(lib, false);
+ }
+
+ public static CompileService create(boolean useCheckedMode) {
+ final CompilerConfiguration config = config(true, useCheckedMode);
final LibrarySource lib = config.getSystemLibraryFor("dart:core");
- return new CompileService(buildArtifactsFor(config, lib), lib);
+ return new CompileService(buildArtifactsFor(config, lib), lib, useCheckedMode);
}
- public static CompileService create(LibrarySource lib) {
- final CompilerConfiguration config = config(true);
- return new CompileService(buildArtifactsFor(config, lib), lib);
+ public static CompileService create(LibrarySource lib, boolean useCheckedMode) {
+ final CompilerConfiguration config = config(true, useCheckedMode);
+ return new CompileService(buildArtifactsFor(config, lib), lib, useCheckedMode);
}
private static ThreadSafeArtifacts buildArtifactsFor(CompilerConfiguration config, LibrarySource lib) {
@@ -209,12 +217,22 @@ public class CompileService {
}
- private static CompilerConfiguration config(final boolean incremental) {
+ private static CompilerConfiguration config(final boolean incremental, final boolean checked) {
return new DefaultCompilerConfiguration() {
@Override
public boolean incremental() {
return incremental;
}
+
+ @Override
+ public boolean shouldWarnOnNoSuchType() {
+ return true;
+ }
+
+ @Override
+ public boolean developerModeChecks() {
+ return checked;
+ }
};
}
@@ -222,9 +240,13 @@ public class CompileService {
private final LibrarySource runtimeLibrary;
- private CompileService(ThreadSafeArtifacts artifactCache, LibrarySource runtimeLibrary) {
+ private final boolean useCheckedMode;
+
+ private CompileService(ThreadSafeArtifacts artifactCache, LibrarySource runtimeLibrary,
+ boolean useCheckedMode) {
this.artifactCache = artifactCache;
this.runtimeLibrary = runtimeLibrary;
+ this.useCheckedMode = useCheckedMode;
}
public CompileResult build(File appFile) {
@@ -260,7 +282,7 @@ public class CompileService {
final long startedAt = System.currentTimeMillis();
try {
DartCompiler.compileLib(source,
- config(true),
+ config(true, useCheckedMode),
artifacts,
listener);
return new CompileResult(artifacts.getJavaScriptFor(source),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698