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

Side by Side Diff: pkg/compiler/lib/src/library_loader.dart

Issue 2005293003: Compute import paths using ImportElement and ExportElement (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Compute members eagerly. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.library_loader; 5 library dart2js.library_loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'common/names.dart' show Uris; 9 import 'common/names.dart' show Uris;
10 import 'common/tasks.dart' show CompilerTask, Measurer; 10 import 'common/tasks.dart' show CompilerTask, Measurer;
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 /// uri of [library] and invokes the [callback] with the concatenated chain. 1383 /// uri of [library] and invokes the [callback] with the concatenated chain.
1384 void computeSuffixes(LibraryElement library, Link<Uri> prefix) { 1384 void computeSuffixes(LibraryElement library, Link<Uri> prefix) {
1385 if (aborted) return; 1385 if (aborted) return;
1386 1386
1387 Uri canonicalUri = library.canonicalUri; 1387 Uri canonicalUri = library.canonicalUri;
1388 prefix = prefix.prepend(canonicalUri); 1388 prefix = prefix.prepend(canonicalUri);
1389 if (suffixChainMap.containsKey(library)) return; 1389 if (suffixChainMap.containsKey(library)) return;
1390 suffixChainMap[library] = const <Link<Uri>>[]; 1390 suffixChainMap[library] = const <Link<Uri>>[];
1391 List<Link<Uri>> suffixes = []; 1391 List<Link<Uri>> suffixes = [];
1392 if (targetUri != canonicalUri) { 1392 if (targetUri != canonicalUri) {
1393 LibraryDependencyNode node = nodeMap[library];
1394
1395 /// Process the import (or export) of [importedLibrary]. 1393 /// Process the import (or export) of [importedLibrary].
1396 void processLibrary(LibraryElement importedLibrary) { 1394 void processLibrary(LibraryElement importedLibrary) {
1397 bool suffixesArePrecomputed = 1395 bool suffixesArePrecomputed =
1398 suffixChainMap.containsKey(importedLibrary); 1396 suffixChainMap.containsKey(importedLibrary);
1399 1397
1400 if (!suffixesArePrecomputed) { 1398 if (!suffixesArePrecomputed) {
1401 computeSuffixes(importedLibrary, prefix); 1399 computeSuffixes(importedLibrary, prefix);
1402 if (aborted) return; 1400 if (aborted) return;
1403 } 1401 }
1404 1402
(...skipping 10 matching lines...) Expand all
1415 suffix = suffix.tail; 1413 suffix = suffix.tail;
1416 } 1414 }
1417 if (!callback(chain)) { 1415 if (!callback(chain)) {
1418 aborted = true; 1416 aborted = true;
1419 return; 1417 return;
1420 } 1418 }
1421 } 1419 }
1422 } 1420 }
1423 } 1421 }
1424 1422
1425 for (ImportLink import in node.imports.reverse()) { 1423 for (ImportElement import in library.imports) {
1426 processLibrary(import.importedLibrary); 1424 processLibrary(import.importedLibrary);
1427 if (aborted) return; 1425 if (aborted) return;
1428 } 1426 }
1429 for (LibraryElement exportedLibrary in node.exports.reverse()) { 1427 for (ExportElement export in library.exports) {
1430 processLibrary(exportedLibrary); 1428 processLibrary(export.exportedLibrary);
1431 if (aborted) return; 1429 if (aborted) return;
1432 } 1430 }
1433 } else { 1431 } else {
1434 // Here `targetUri == canonicalUri`. 1432 // Here `targetUri == canonicalUri`.
1435 if (!callback(prefix)) { 1433 if (!callback(prefix)) {
1436 aborted = true; 1434 aborted = true;
1437 return; 1435 return;
1438 } 1436 }
1439 suffixes.add(const Link<Uri>().prepend(canonicalUri)); 1437 suffixes.add(const Link<Uri>().prepend(canonicalUri));
1440 } 1438 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 Future onLibrariesLoaded(LoadedLibraries results); 1507 Future onLibrariesLoaded(LoadedLibraries results);
1510 1508
1511 /// Called whenever a library element is created. 1509 /// Called whenever a library element is created.
1512 void onLibraryCreated(LibraryElement library); 1510 void onLibraryCreated(LibraryElement library);
1513 1511
1514 /// Called whenever a library is scanned from a script file. 1512 /// Called whenever a library is scanned from a script file.
1515 Future onLibraryScanned(LibraryElement library, LibraryLoader loader); 1513 Future onLibraryScanned(LibraryElement library, LibraryLoader loader);
1516 } 1514 }
1517 1515
1518 const _reuseLibrarySubtaskName = "Reuse library"; 1516 const _reuseLibrarySubtaskName = "Reuse library";
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/serialization/modelz.dart » ('j') | pkg/compiler/lib/src/serialization/modelz.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698