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

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

Issue 25559004: Handle exports being registered before declarations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated status + comment. Created 7 years, 2 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 | sdk/lib/_internal/compiler/implementation/patch_parser.dart » ('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 bad6e10da309ea9cb592193a38dbb855c60de301..85191f17ef019e4440efdf532f39c81134e4eff7 100644
--- a/sdk/lib/_internal/compiler/implementation/library_loader.dart
+++ b/sdk/lib/_internal/compiler/implementation/library_loader.dart
@@ -714,12 +714,14 @@ class LibraryDependencyNode {
*/
Element addElementToExportScope(Compiler compiler, Element element,
Link<Export> exports) {
-
SourceString name = element.name;
void reportDuplicateExport(Element duplicate,
Link<Export> duplicateExports,
{bool reportError: true}) {
+ assert(invariant(library, !duplicateExports.isEmpty,
+ message: "No export for $duplicate from ${duplicate.getLibrary()} "
+ "in $library."));
compiler.withCurrentElement(library, () {
for (Export export in duplicateExports) {
if (reportError) {
@@ -736,6 +738,9 @@ class LibraryDependencyNode {
void reportDuplicateExportDecl(Element duplicate,
Link<Export> duplicateExports) {
+ assert(invariant(library, !duplicateExports.isEmpty,
+ message: "No export for $duplicate from ${duplicate.getLibrary()} "
+ "in $library."));
compiler.reportInfo(duplicate, MessageKind.DUPLICATE_EXPORT_DECL,
{'name': name, 'uriString': duplicateExports.head.uri});
}
@@ -746,7 +751,13 @@ class LibraryDependencyNode {
reportDuplicateExport(element, exports);
reportDuplicateExportDecl(element, exports);
element = existingElement;
- } else if (existingElement.getLibrary() != library) {
+ } else if (existingElement.getLibrary() == library) {
+ // Do nothing. [existingElement] hides [element].
+ } else if (element.getLibrary() == library) {
+ // [element] hides [existingElement].
+ exportScope[name] = element;
+ exporters[element] = exports;
+ } else {
// Declared elements hide exported elements.
Link<Export> existingExports = exporters[existingElement];
reportDuplicateExport(existingElement, existingExports);
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/patch_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698