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

Side by Side Diff: dart/sdk/lib/_internal/compiler/implementation/library_loader.dart

Issue 494623002: Implement diff algorithm for libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 import 'dart2jslib.dart' 8 import 'dart2jslib.dart'
9 show Compiler, 9 show Compiler,
10 CompilerTask, 10 CompilerTask,
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 // TODO(johnniwinther): Create erroneous library elements for missing 491 // TODO(johnniwinther): Create erroneous library elements for missing
492 // libraries. 492 // libraries.
493 Uri readableUri = 493 Uri readableUri =
494 compiler.translateResolvedUri(importingLibrary, resolvedUri, node); 494 compiler.translateResolvedUri(importingLibrary, resolvedUri, node);
495 if (readableUri == null) return new Future.value(); 495 if (readableUri == null) return new Future.value();
496 LibraryElement library = libraryCanonicalUriMap[resolvedUri]; 496 LibraryElement library = libraryCanonicalUriMap[resolvedUri];
497 if (library != null) { 497 if (library != null) {
498 return new Future.value(library); 498 return new Future.value(library);
499 } 499 }
500 return compiler.withCurrentElement(importingLibrary, () { 500 return compiler.withCurrentElement(importingLibrary, () {
501 return compiler.readScript(node, readableUri) 501 return compiler.readScript(node, readableUri).then((Script script) {
502 .then((Script script) { 502 if (script == null) return null;
503 if (script == null) return null; 503 LibraryElement element =
504 LibraryElement element = new LibraryElementX(script, resolvedUri); 504 createLibrarySync(handler, script, resolvedUri);
505 compiler.withCurrentElement(element, () { 505 return processLibraryTags(handler, element).then((_) {
506 handler.registerNewLibrary(element); 506 compiler.withCurrentElement(element, () {
507 native.maybeEnableNative(compiler, element); 507 handler.registerLibraryExports(element);
508 libraryCanonicalUriMap[resolvedUri] = element;
509 compiler.scanner.scanLibrary(element);
510 });
511 return processLibraryTags(handler, element).then((_) {
512 compiler.withCurrentElement(element, () {
513 handler.registerLibraryExports(element);
514 });
515 return element;
516 });
517 }); 508 });
509 return element;
510 });
511 });
512 });
513 }
514
515 LibraryElement createLibrarySync(
516 LibraryDependencyHandler handler,
517 Script script,
518 Uri resolvedUri) {
519 LibraryElement element = new LibraryElementX(script, resolvedUri);
520 return compiler.withCurrentElement(element, () {
521 if (handler != null) {
522 handler.registerNewLibrary(element);
523 libraryCanonicalUriMap[resolvedUri] = element;
524 }
525 native.maybeEnableNative(compiler, element);
526 compiler.scanner.scanLibrary(element);
527 return element;
518 }); 528 });
519 } 529 }
520 } 530 }
521 531
522 532
523 /** 533 /**
524 * The fields of this class models a state machine for checking script 534 * The fields of this class models a state machine for checking script
525 * tags come in the correct order. 535 * tags come in the correct order.
526 */ 536 */
527 class TagState { 537 class TagState {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 * fixed-point computation of the import/export scopes. 965 * fixed-point computation of the import/export scopes.
956 */ 966 */
957 void registerLibraryExports(LibraryElement library) { 967 void registerLibraryExports(LibraryElement library) {
958 nodeMap[library].registerInitialExports(); 968 nodeMap[library].registerInitialExports();
959 } 969 }
960 970
961 Future processLibraryTags(LibraryElement library) { 971 Future processLibraryTags(LibraryElement library) {
962 return task.processLibraryTags(this, library); 972 return task.processLibraryTags(this, library);
963 } 973 }
964 } 974 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698