OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library rasta.kernel; | 5 library rasta.kernel; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:collection' show | 10 import 'dart:collection' show |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 seen.add(library); | 556 seen.add(library); |
557 LibraryElement core = | 557 LibraryElement core = |
558 compiler.libraryLoader.lookupLibrary(Uri.parse("dart:core")); | 558 compiler.libraryLoader.lookupLibrary(Uri.parse("dart:core")); |
559 if (seen.add(core)) { | 559 if (seen.add(core)) { |
560 // `dart:core` is implicitly imported by most libraries, and for some | 560 // `dart:core` is implicitly imported by most libraries, and for some |
561 // reason not included in `library.imports` below. | 561 // reason not included in `library.imports` below. |
562 processLater(core); | 562 processLater(core); |
563 } | 563 } |
564 while (notProcessed.isNotEmpty) { | 564 while (notProcessed.isNotEmpty) { |
565 LibraryElement library = notProcessed.removeFirst(); | 565 LibraryElement library = notProcessed.removeFirst(); |
566 ir.Library irLibrary = libraries[library]; | 566 ir.Library irLibrary = libraryToIr(library); |
567 for (ImportElement import in library.imports) { | 567 for (ImportElement import in library.imports) { |
568 if (seen.add(import.importedLibrary)) { | 568 if (seen.add(import.importedLibrary)) { |
569 processLater(import.importedLibrary); | 569 processLater(import.importedLibrary); |
570 } | 570 } |
571 } | 571 } |
572 for (ExportElement export in library.exports) { | 572 for (ExportElement export in library.exports) { |
573 if (seen.add(export.exportedLibrary)) { | 573 if (seen.add(export.exportedLibrary)) { |
574 processLater(export.exportedLibrary); | 574 processLater(export.exportedLibrary); |
575 } | 575 } |
576 } | 576 } |
577 for (ImportElement import in library.implementation.imports) { | 577 for (ImportElement import in library.implementation.imports) { |
578 if (seen.add(import.importedLibrary)) { | 578 if (seen.add(import.importedLibrary)) { |
579 processLater(import.importedLibrary); | 579 processLater(import.importedLibrary); |
580 } | 580 } |
581 } | 581 } |
582 for (ExportElement export in library.implementation.exports) { | 582 for (ExportElement export in library.implementation.exports) { |
583 if (seen.add(export.exportedLibrary)) { | 583 if (seen.add(export.exportedLibrary)) { |
584 processLater(export.exportedLibrary); | 584 processLater(export.exportedLibrary); |
585 } | 585 } |
586 } | 586 } |
587 if (irLibrary != null) { | 587 if (irLibrary != null) { |
588 result.add(irLibrary); | 588 result.add(irLibrary); |
589 } | 589 } |
590 } | 590 } |
| 591 processWorkQueue(); |
591 return result; | 592 return result; |
592 } | 593 } |
593 | 594 |
594 /// Returns true if [element] is synthesized to recover or represent a | 595 /// Returns true if [element] is synthesized to recover or represent a |
595 /// semantic error, for example, missing, duplicated, or ambiguous elements. | 596 /// semantic error, for example, missing, duplicated, or ambiguous elements. |
596 /// However, returns false for elements that have an unrecoverable syntax | 597 /// However, returns false for elements that have an unrecoverable syntax |
597 /// error. Both kinds of element will return true from [Element.isMalformed], | 598 /// error. Both kinds of element will return true from [Element.isMalformed], |
598 /// but they must be handled differently. For example, a static call to | 599 /// but they must be handled differently. For example, a static call to |
599 /// synthetic error element should be compiled to [ir.InvalidExpression], | 600 /// synthetic error element should be compiled to [ir.InvalidExpression], |
600 /// whereas a static call to a method which has a syntax error should be | 601 /// whereas a static call to a method which has a syntax error should be |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 } | 685 } |
685 | 686 |
686 class ConstructorTarget { | 687 class ConstructorTarget { |
687 final ConstructorElement element; | 688 final ConstructorElement element; |
688 final DartType type; | 689 final DartType type; |
689 | 690 |
690 ConstructorTarget(this.element, this.type); | 691 ConstructorTarget(this.element, this.type); |
691 | 692 |
692 String toString() => "ConstructorTarget($element, $type)"; | 693 String toString() => "ConstructorTarget($element, $type)"; |
693 } | 694 } |
OLD | NEW |