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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.kernel_library_builder; | 5 library fasta.kernel_library_builder; |
6 | 6 |
7 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; | 7 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; |
8 import 'package:front_end/src/fasta/combinator.dart' as fasta; | 8 import 'package:front_end/src/fasta/combinator.dart' as fasta; |
9 import 'package:front_end/src/fasta/export.dart'; | 9 import 'package:front_end/src/fasta/export.dart'; |
10 import 'package:front_end/src/fasta/import.dart'; | 10 import 'package:front_end/src/fasta/import.dart'; |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 importedLibrary = importedBuilder.library; | 752 importedLibrary = importedBuilder.library; |
753 } else if (importedBuilder is KernelLibraryBuilder) { | 753 } else if (importedBuilder is KernelLibraryBuilder) { |
754 importedLibrary = importedBuilder.library; | 754 importedLibrary = importedBuilder.library; |
755 } | 755 } |
756 if (importedLibrary != null) { | 756 if (importedLibrary != null) { |
757 library.addDependency(new LibraryDependency.import(importedLibrary, | 757 library.addDependency(new LibraryDependency.import(importedLibrary, |
758 name: import.prefix, | 758 name: import.prefix, |
759 combinators: toKernelCombinators(import.combinators))); | 759 combinators: toKernelCombinators(import.combinators))); |
760 } | 760 } |
761 } | 761 } |
| 762 |
762 for (Export export in exports) { | 763 for (Export export in exports) { |
763 var exportedBuilder = export.exported; | 764 var exportedBuilder = export.exported; |
764 Library exportedLibrary; | 765 Library exportedLibrary; |
765 if (exportedBuilder is DillLibraryBuilder) { | 766 if (exportedBuilder is DillLibraryBuilder) { |
766 exportedLibrary = exportedBuilder.library; | 767 exportedLibrary = exportedBuilder.library; |
767 } else if (exportedBuilder is KernelLibraryBuilder) { | 768 } else if (exportedBuilder is KernelLibraryBuilder) { |
768 exportedLibrary = exportedBuilder.library; | 769 exportedLibrary = exportedBuilder.library; |
769 } | 770 } |
770 if (exportedLibrary != null) { | 771 if (exportedLibrary != null) { |
771 library.addDependency(new LibraryDependency.export(exportedLibrary, | 772 library.addDependency(new LibraryDependency.export(exportedLibrary, |
772 combinators: toKernelCombinators(export.combinators))); | 773 combinators: toKernelCombinators(export.combinators))); |
773 } | 774 } |
774 } | 775 } |
| 776 |
| 777 for (var part in parts) { |
| 778 // TODO(scheglov): Add support for annotations, see |
| 779 // https://github.com/dart-lang/sdk/issues/30284. |
| 780 String fileUri = part.fileUri.toString(); |
| 781 library.addPart(new LibraryPart(<Expression>[], fileUri)); |
| 782 } |
| 783 |
775 library.name = name; | 784 library.name = name; |
776 library.procedures.sort(compareProcedures); | 785 library.procedures.sort(compareProcedures); |
777 return library; | 786 return library; |
778 } | 787 } |
779 | 788 |
780 @override | 789 @override |
781 Builder buildAmbiguousBuilder( | 790 Builder buildAmbiguousBuilder( |
782 String name, Builder builder, Builder other, int charOffset, | 791 String name, Builder builder, Builder other, int charOffset, |
783 {bool isExport: false, bool isImport: false}) { | 792 {bool isExport: false, bool isImport: false}) { |
784 // TODO(ahe): Can I move this to Scope or Prefix? | 793 // TODO(ahe): Can I move this to Scope or Prefix? |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 mixinApplicationClasses.putIfAbsent(name, () => builder); | 947 mixinApplicationClasses.putIfAbsent(name, () => builder); |
939 if (existing != builder) { | 948 if (existing != builder) { |
940 part.scope.local.remove(name); | 949 part.scope.local.remove(name); |
941 } | 950 } |
942 }); | 951 }); |
943 super.includePart(part); | 952 super.includePart(part); |
944 nativeMethods.addAll(part.nativeMethods); | 953 nativeMethods.addAll(part.nativeMethods); |
945 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 954 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
946 } | 955 } |
947 } | 956 } |
OLD | NEW |