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

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: Merged with r39546. 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
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, () {
506 handler.registerNewLibrary(element);
507 native.maybeEnableNative(compiler, element);
508 libraryCanonicalUriMap[resolvedUri] = element;
509 compiler.scanner.scanLibrary(element);
510 });
511 return processLibraryTags(handler, element).then((_) { 505 return processLibraryTags(handler, element).then((_) {
Johnni Winther 2014/08/26 12:31:03 This should be de-indented.
ahe 2014/08/26 13:01:33 Done.
512 compiler.withCurrentElement(element, () { 506 compiler.withCurrentElement(element, () {
513 handler.registerLibraryExports(element); 507 handler.registerLibraryExports(element);
514 }); 508 });
515 return element; 509 return element;
516 }); 510 });
517 }); 511
512 });
513 });
514 }
515
516 LibraryElement createLibrarySync(
517 LibraryDependencyHandler handler,
518 Script script,
519 Uri resolvedUri) {
520 LibraryElement element = new LibraryElementX(script, resolvedUri);
521 return compiler.withCurrentElement(element, () {
522 if (handler != null) {
523 handler.registerNewLibrary(element);
524 libraryCanonicalUriMap[resolvedUri] = element;
525 }
526 native.maybeEnableNative(compiler, element);
527 compiler.scanner.scanLibrary(element);
528 return element;
518 }); 529 });
519 } 530 }
520 } 531 }
521 532
522 533
523 /** 534 /**
524 * The fields of this class models a state machine for checking script 535 * The fields of this class models a state machine for checking script
525 * tags come in the correct order. 536 * tags come in the correct order.
526 */ 537 */
527 class TagState { 538 class TagState {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 * fixed-point computation of the import/export scopes. 966 * fixed-point computation of the import/export scopes.
956 */ 967 */
957 void registerLibraryExports(LibraryElement library) { 968 void registerLibraryExports(LibraryElement library) {
958 nodeMap[library].registerInitialExports(); 969 nodeMap[library].registerInitialExports();
959 } 970 }
960 971
961 Future processLibraryTags(LibraryElement library) { 972 Future processLibraryTags(LibraryElement library) {
962 return task.processLibraryTags(this, library); 973 return task.processLibraryTags(this, library);
963 } 974 }
964 } 975 }
OLDNEW
« no previous file with comments | « no previous file | dart/sdk/lib/_internal/compiler/implementation/scanner/listener.dart » ('j') | dart/tests/try/poi/diff_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698