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

Unified Diff: sdk/lib/_internal/compiler/implementation/library_loader.dart

Issue 11360149: Report errors on duplicate export. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments Created 8 years, 1 month 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 | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/library_loader.dart
diff --git a/sdk/lib/_internal/compiler/implementation/library_loader.dart b/sdk/lib/_internal/compiler/implementation/library_loader.dart
index 359aa435f4b7bc7a141e8c8eb74715c9f462d1a0..6a247e209c633f2df7c821a03215fdccb00968a8 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -173,11 +173,12 @@ class LibraryLoaderTask extends LibraryLoader {
Uri base = library.entryCompilationUnit.script.uri;
for (LibraryTag tag in library.tags.reverse()) {
if (tag.isImport) {
- tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag);
- if (tag.uri.dartString.slowToString() == 'dart:core') {
+ Import import = tag;
+ tagState = checkTag(TagState.IMPORT_OR_EXPORT, import);
+ if (import.uri.dartString.slowToString() == 'dart:core') {
importsDartCore = true;
}
- libraryDependencies.addLast(tag);
+ libraryDependencies.addLast(import);
} else if (tag.isExport) {
tagState = checkTag(TagState.IMPORT_OR_EXPORT, tag);
libraryDependencies.addLast(tag);
@@ -190,10 +191,11 @@ class LibraryLoaderTask extends LibraryLoader {
}
checkDuplicatedLibraryName(library);
} else if (tag.isPart) {
- StringNode uri = tag.uri;
+ Part part = tag;
+ StringNode uri = part.uri;
Uri resolved = base.resolve(uri.dartString.slowToString());
- tagState = checkTag(TagState.SOURCE, tag);
- scanPart(tag, resolved, library);
+ tagState = checkTag(TagState.SOURCE, part);
+ scanPart(part, resolved, library);
} else {
compiler.internalError("Unhandled library tag.", node: tag);
}
@@ -546,8 +548,16 @@ class LibraryDependencyNode {
SourceString name = element.name;
Element existingElement = exportScope[name];
if (existingElement != null) {
- if (existingElement.getLibrary() != library) {
+ if (existingElement.isErroneous()) {
+ compiler.reportMessage(compiler.spanFromElement(element),
+ MessageKind.DUPLICATE_EXPORT.error([name]), api.Diagnostic.ERROR);
+ element = existingElement;
+ } else if (existingElement.getLibrary() != library) {
// Declared elements hide exported elements.
+ compiler.reportMessage(compiler.spanFromElement(existingElement),
+ MessageKind.DUPLICATE_EXPORT.error([name]), api.Diagnostic.ERROR);
+ compiler.reportMessage(compiler.spanFromElement(element),
+ MessageKind.DUPLICATE_EXPORT.error([name]), api.Diagnostic.ERROR);
element = exportScope[name] = new ErroneousElement(
MessageKind.DUPLICATE_EXPORT, [name], name, library);
}
« no previous file with comments | « no previous file | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698