@@ -113,7 +113,7 @@ class _Linker {
113113 if (ngMeta.needsResolution) {
114114 final resolver = new _NgMetaIdentifierResolver (
115115 assetId, reader, ngMetas, resolvedIdentifiers, errorOnMissingIdentifiers);
116- return resolver.resolveNgMeta (ngMeta);
116+ return resolver.resolveNgMeta (ngMeta, assetId );
117117 } else {
118118 return null ;
119119 }
@@ -177,8 +177,8 @@ class _NgMetaIdentifierResolver {
177177
178178 _NgMetaIdentifierResolver (this .entryPoint, this .reader, this .ngMetas, this .resolvedIdentifiers, this .errorOnMissingIdentifiers);
179179
180- Future resolveNgMeta (NgMeta ngMeta) async {
181- final ngMetaMap = await _extractNgMetaMap (ngMeta);
180+ Future resolveNgMeta (NgMeta ngMeta, AssetId assetId ) async {
181+ final ngMetaMap = await _extractNgMetaMap (ngMeta, assetId );
182182 ngMeta.identifiers.forEach ((_, meta) {
183183 if (meta is CompileIdentifierMetadata && meta.value != null ) {
184184 meta.value = _resolveProviders (ngMetaMap, meta.value, "root" );
@@ -375,14 +375,16 @@ class _NgMetaIdentifierResolver {
375375 name: id.name, moduleUrl: resolvedIdentifiers[id.name]);
376376
377377 // these are so common that we special case them in the transformer
378- } else if (id.name == "Window" || id.name == "Document" ) {
378+ } else if (id.name == "Window" || id.name == "Document" || id.name == "Storage" ) {
379379 return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'dart:html' );
380+ } else if (id.name == "Random" ) {
381+ return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'dart:math' );
380382 } else if (id.name == "Profiler" ) {
381383 return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'asset:perf_api/lib/perf_api.dart' );
382384 } else if (id.name == "Logger" ) {
383385 return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'asset:logging/lib/logging.dart' );
384386 } else if (id.name == "Clock" ) {
385- return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'asset:quiver/lib/src/ time/clock .dart' );
387+ return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'asset:quiver/lib/time.dart' );
386388 } else if (id.name == "Log" ) {
387389 return new CompileIdentifierMetadata (name: id.name, moduleUrl: 'asset:angular2/lib/src/testing/utils.dart' );
388390 } else if (id.name == "TestComponentBuilder" ) {
@@ -421,7 +423,7 @@ class _NgMetaIdentifierResolver {
421423
422424 /// Walks all the imports and creates a map from prefixes to
423425 /// all the symbols available through those prefixes
424- Future <Map <String , NgMeta >> _extractNgMetaMap (NgMeta ngMeta) async {
426+ Future <Map <String , NgMeta >> _extractNgMetaMap (NgMeta ngMeta, AssetId assetId ) async {
425427 final res = {"" : new NgMeta .empty ()};
426428 res["" ].addAll (ngMeta);
427429
@@ -442,11 +444,34 @@ class _NgMetaIdentifierResolver {
442444 if (newMeta != null ) {
443445 res[import.prefix].addAll (newMeta);
444446 } else {
445- final summaryAsset =
446- fromUri (_urlResolver.resolve (assetUri, toSummaryExtension (import.uri)));
447+ final summaryUri = _urlResolver.resolve (
448+ assetUri, toSummaryExtension (import.uri));
449+ final summaryAsset = fromUri (summaryUri);
447450 final summary = await _readNgMeta (reader, summaryAsset, {});
448451 if (summary != null ) {
449- res[import.prefix].addAll (summary);
452+
453+ // We get here if we are in an import/export cycle. To resolve this
454+ // we load the summaries directly. This is sufficient for resolving
455+ // which module the symbol is defined in, which is the purpose of the
456+ // map we are building.
457+ final prefixRes = res[import.prefix];
458+ prefixRes.addAll (summary);
459+ if (summary.ngDeps != null &&
460+ summary.ngDeps.exports != null ) {
461+
462+
463+ // Re-exporting one level of exports is usually sufficient.
464+ // Consider a recursively exporting exports.
465+ for (var export in summary.ngDeps.exports) {
466+ final exportAsset = fromUri (
467+ _urlResolver.resolve (
468+ summaryUri, toSummaryExtension (export.uri)));
469+ final exportSummary = await _readNgMeta (reader, exportAsset, {});
470+ if (exportSummary != null ) {
471+ prefixRes.addAll (exportSummary);
472+ }
473+ }
474+ }
450475 }
451476 }
452477 }
0 commit comments