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

Unified Diff: compiler/java/com/google/dart/compiler/DartCompiler.java

Issue 10659037: Issue 3839. Warn when 'dart:io' and 'dart:html' are used in single library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Report Editor specific warning as ErrorSeverity.INFO Created 8 years, 6 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 | compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/DartCompiler.java
diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java
index 5e462ba5ce179b868e96ea79542f483a2586e48e..385d3c7c35db3efe76c1dcb54f49df1cbf0791c0 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -637,13 +637,23 @@ public class DartCompiler {
}
}
- // Validate import prefixes.
+ // Validate imports.
+ boolean hasIO = false;
+ boolean hasHTML = false;
for (LibraryNode importNode : lib.getImportPaths()) {
String prefix = importNode.getPrefix();
+ hasIO |= "dart:io".equals(importNode.getText());
+ hasHTML |= "dart:html".equals(importNode.getText());
+ // validate import prefix
if (DartParser.PSEUDO_KEYWORDS_SET.contains(prefix)) {
context.onError(new DartCompilationError(importNode.getSourceInfo(),
ResolverErrorCode.BUILT_IN_IDENTIFIER_AS_IMPORT_PREFIX, prefix));
}
+ // validate console/web mix
+ if (hasIO && hasHTML) {
+ context.onError(new DartCompilationError(importNode.getSourceInfo(),
+ DartCompilerErrorCode.CONSOLE_WEB_MIX));
+ }
}
// check that each imported library has a library directive
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/DartCompilerErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698