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

Unified Diff: pkg/analyzer/lib/src/summary/resynthesize.dart

Issue 1576213002: Compute exportNamespace during resynthesizing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index d6221623e16c1b7bc1038bf8aeec8dda35698d52..9663fd98654572cad727b47c8bdc267c7a645ee2 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -691,15 +691,10 @@ class _LibraryResynthesizer {
unlinkedDefiningUnit.exports[i]));
}
libraryElement.exports = exports;
- FunctionElement entryPoint = populateUnit(definingCompilationUnit, 0);
+ populateUnit(definingCompilationUnit, 0);
for (int i = 0; i < parts.length; i++) {
- FunctionElement unitEntryPoint = populateUnit(parts[i], i + 1);
- if (entryPoint == null) {
- entryPoint = unitEntryPoint;
- }
+ populateUnit(parts[i], i + 1);
}
- // TODO(paulberry): also look for entry points in exports.
- libraryElement.entryPoint = entryPoint;
if (isCoreLibrary) {
ClassElement objectElement = libraryElement.getType('Object');
assert(objectElement != null);
@@ -707,9 +702,16 @@ class _LibraryResynthesizer {
classElement.supertype = objectElement.type;
}
}
- // Compute public namespace.
+ // Compute namespaces.
libraryElement.publicNamespace =
new NamespaceBuilder().createPublicNamespaceForLibrary(libraryElement);
+ libraryElement.exportNamespace =
Paul Berry 2016/01/11 23:33:40 Please add: // TODO(paulberry): compute the expor
+ new NamespaceBuilder().createExportNamespaceForLibrary(libraryElement);
+ // Find the entry point.
+ libraryElement.entryPoint =
+ libraryElement.exportNamespace.definedNames.values.firstWhere(
+ (element) => element is FunctionElement && element.isEntryPoint,
+ orElse: () => null);
// Done.
return libraryElement;
}
@@ -961,10 +963,8 @@ class _LibraryResynthesizer {
/**
* Populate a [CompilationUnitElement] by deserializing all the elements
* contained in it.
- *
- * If the compilation unit has an entry point, it is returned.
*/
- FunctionElement populateUnit(CompilationUnitElementImpl unit, int unitNum) {
+ void populateUnit(CompilationUnitElementImpl unit, int unitNum) {
prelinkedUnit = prelinkedLibrary.units[unitNum];
unlinkedUnit = unlinkedUnits[unitNum];
unitHolder = new ElementHolder();
@@ -996,17 +996,9 @@ class _LibraryResynthesizer {
for (FunctionTypeAliasElement typeAlias in unit.functionTypeAliases) {
elementMap[typeAlias.name] = typeAlias;
}
- FunctionElement entryPoint = null;
- for (FunctionElement function in unit.functions) {
- if (function.isEntryPoint) {
- entryPoint = function;
- break;
- }
- }
resummarizedElements[absoluteUri] = elementMap;
unitHolder = null;
prelinkedUnit = null;
unlinkedUnit = null;
- return entryPoint;
}
}

Powered by Google App Engine
This is Rietveld 408576698