| 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 0639e82754e44d1d9b8c7aab1822e5e9684ce8cd..8842ec66bad4dc780c7e105aedc15260883e4944 100644
|
| --- a/compiler/java/com/google/dart/compiler/DartCompiler.java
|
| +++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
|
| @@ -619,6 +619,20 @@ public class DartCompiler {
|
| if (SystemLibraryManager.isDartUri(lib.getSource().getUri())) {
|
| continue;
|
| }
|
| +
|
| + // check for #source uniqueness
|
| + {
|
| + Set<URI> includedSourceUris = Sets.newHashSet();
|
| + for (LibraryNode sourceNode : lib.getSourcePaths()) {
|
| + String path = sourceNode.getText();
|
| + URI uri = lib.getSource().getSourceFor(path).getUri();
|
| + if (includedSourceUris.contains(uri)) {
|
| + context.onError(new DartCompilationError(sourceNode.getSourceInfo(),
|
| + DartCompilerErrorCode.UNIT_WAS_ALREADY_INCLUDED, uri));
|
| + }
|
| + includedSourceUris.add(uri);
|
| + }
|
| + }
|
|
|
| // Validate import prefixes.
|
| for (LibraryNode importNode : lib.getImportPaths()) {
|
| @@ -682,6 +696,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,
|
|
|