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

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

Issue 10532100: Issue 3532. Report error if one unit included twice (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 dd85e0b109ce94f4687c1b3210255d64f2e9e1f0..a199884fa04163b915519244ddd57427b3fe83b1 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -619,6 +619,19 @@ public class DartCompiler {
if (SystemLibraryManager.isDartUri(lib.getSource().getUri())) {
continue;
}
+
+ // check for #source uniqueness
+ {
+ Set<String> includedSourcePaths = Sets.newHashSet();
+ for (LibraryNode sourceNode : lib.getSourcePaths()) {
+ String path = sourceNode.getText();
Brian Wilkerson 2012/06/12 15:34:14 I'm not sure this is correct. Don't we need to cat
scheglov 2012/06/12 18:17:51 Done.
+ if (includedSourcePaths.contains(path)) {
+ context.onError(new DartCompilationError(sourceNode.getSourceInfo(),
+ DartCompilerErrorCode.UNIT_WAS_ALREADY_INCLUDED, path));
+ }
+ includedSourcePaths.add(path);
+ }
+ }
// check that each imported library has a library directive
for (LibraryUnit importedLib : lib.getImports()) {
@@ -673,6 +686,7 @@ public class DartCompiler {
continue;
}
DartSource dartSource = (DartSource) unit.getSourceInfo().getSource();
+ // check for directives
if (dartSource.getRelativePath().equals(sourceNode.getText())) {
context.onError(new DartCompilationError(unit.getDirectives().get(0),
DartCompilerErrorCode.ILLEGAL_DIRECTIVES_IN_SOURCED_UNIT,

Powered by Google App Engine
This is Rietveld 408576698