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

Unified Diff: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java

Issue 9466013: Issue 1129. Report #import errors after parsing, so after "unitAboutToCompile". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « compiler/java/com/google/dart/compiler/DartCompiler.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
diff --git a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
index 79726755897f3e0b0d8b2ba05023ffd4015d6b61..8ebf6532f3188826ae9a2ef7e9cc24cb970f793c 100644
--- a/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
+++ b/compiler/javatests/com/google/dart/compiler/end2end/inc/IncrementalCompilation2Test.java
@@ -14,11 +14,14 @@ import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.CompilerTestCase;
import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.DartCompiler;
+import com.google.dart.compiler.DartCompilerErrorCode;
import com.google.dart.compiler.DartCompilerListener;
+import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.DefaultCompilerConfiguration;
import com.google.dart.compiler.LibrarySource;
import com.google.dart.compiler.MockArtifactProvider;
import com.google.dart.compiler.Source;
+import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.backend.js.JavascriptBackend;
import com.google.dart.compiler.resolver.ResolverErrorCode;
import com.google.dart.compiler.resolver.TypeErrorCode;
@@ -81,8 +84,7 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
return false;
}
};
- config = new DefaultCompilerConfiguration(new JavascriptBackend(),
- compilerOptions) {
+ config = new DefaultCompilerConfiguration(new JavascriptBackend(), compilerOptions) {
@Override
public boolean incremental() {
return true;
@@ -341,7 +343,7 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
* Test for "hole" feature. If we use qualified access and add/remove top-level field, this should
* not cause compilation of invocation unit.
*/
- public void test_gieldHole_useQualifiedAccess() {
+ public void test_fieldHole_useQualifiedAccess() {
appSource.setContent(
"B.dart",
makeCode(
@@ -534,6 +536,41 @@ public class IncrementalCompilation2Test extends CompilerTestCase {
errEx("B.dart", ResolverErrorCode.DUPLICATE_TOP_LEVEL_DEFINITION, 2, 5, 8));
}
+ // XXX
zundel 2012/02/24 19:48:39 fill in comment
+ public void test_reportMissingImportSourcce() throws Exception {
+ appSourceContent =
+ makeCode(
+ "// filler filler filler filler filler filler filler filler filler filler filler",
+ "#library('app');",
+ "#import('dart:noSuchLib.dart');",
+ "");
+ // Remember errors only between unitAboutToCompile/unitCompiled.
+ errors.clear();
+ DartCompilerListener listener = new DartCompilerListener.Empty() {
+ boolean isCompiling = false;
+
+ @Override
+ public void unitAboutToCompile(DartSource source, boolean diet) {
+ isCompiling = true;
+ }
+
+ @Override
+ public void onError(DartCompilationError event) {
+ if (isCompiling) {
+ errors.add(event);
+ }
+ }
+
+ @Override
+ public void unitCompiled(DartUnit unit) {
+ isCompiling = false;
+ }
+ };
+ DartCompiler.compileLib(appSource, config, provider, listener);
+ // Check that errors where reported (and in correct time).
+ assertErrors(errors, errEx(DartCompilerErrorCode.MISSING_SOURCE, 3, 1, 31));
+ }
+
private void assertAppBuilt() {
didWrite(APP, EXTENSION_DEPS);
didWrite(APP, EXTENSION_APP_JS);
« no previous file with comments | « compiler/java/com/google/dart/compiler/DartCompiler.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698