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

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java

Issue 60913003: Issue 13787. It is OK to export same element twice. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
index de7bd5a7995666258305c5544c414686b45fa30e..db18d2e7ea3574a1b32d9290f81ef4d059cac71c 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
@@ -335,9 +335,9 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
private HashMap<String, LibraryElement> nameToImportElement = new HashMap<String, LibraryElement>();
/**
- * A table mapping names to the export elements exported them.
+ * A table mapping names to the exported elements.
*/
- private HashMap<String, ExportElement> exportedNames = new HashMap<String, ExportElement>();
+ private HashMap<String, Element> exportedElements = new HashMap<String, Element>();
/**
* A set of the names of the variable initializers we are visiting now.
@@ -1732,19 +1732,21 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
}
// check exported names
Namespace namespace = new NamespaceBuilder().createExportNamespace(exportElement);
- Set<String> newNames = namespace.getDefinedNames().keySet();
- for (String name : newNames) {
- ExportElement prevElement = exportedNames.get(name);
- if (prevElement != null && prevElement != exportElement) {
+ Map<String, Element> definedNames = namespace.getDefinedNames();
+ for (Entry<String, Element> definedEntry : definedNames.entrySet()) {
+ String name = definedEntry.getKey();
+ Element element = definedEntry.getValue();
+ Element prevElement = exportedElements.get(name);
+ if (element != null && prevElement != null && !prevElement.equals(element)) {
errorReporter.reportError(
CompileTimeErrorCode.AMBIGUOUS_EXPORT,
node,
name,
- prevElement.getExportedLibrary().getDefiningCompilationUnit().getDisplayName(),
- exportedLibrary.getDefiningCompilationUnit().getDisplayName());
+ prevElement.getLibrary().getDefiningCompilationUnit().getDisplayName(),
+ element.getLibrary().getDefiningCompilationUnit().getDisplayName());
return true;
} else {
- exportedNames.put(name, exportElement);
+ exportedElements.put(name, element);
}
}
return false;

Powered by Google App Engine
This is Rietveld 408576698