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'; |
| 8 import 'package:front_end/src/fasta/import.dart'; |
7 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
8 | 10 |
9 import 'package:kernel/clone.dart' show CloneVisitor; | 11 import 'package:kernel/clone.dart' show CloneVisitor; |
10 | 12 |
11 import '../../scanner/token.dart' show Token; | 13 import '../../scanner/token.dart' show Token; |
12 | 14 |
13 import '../fasta_codes.dart' | 15 import '../fasta_codes.dart' |
14 show | 16 show |
15 Message, | 17 Message, |
16 messageConflictsWithTypeVariableCause, | 18 messageConflictsWithTypeVariableCause, |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 // Nothing needed. | 699 // Nothing needed. |
698 } else { | 700 } else { |
699 unhandled("${builder.runtimeType}", "buildBuilder", builder.charOffset, | 701 unhandled("${builder.runtimeType}", "buildBuilder", builder.charOffset, |
700 builder.fileUri); | 702 builder.fileUri); |
701 } | 703 } |
702 } | 704 } |
703 | 705 |
704 @override | 706 @override |
705 Library build(LibraryBuilder coreLibrary) { | 707 Library build(LibraryBuilder coreLibrary) { |
706 super.build(coreLibrary); | 708 super.build(coreLibrary); |
| 709 for (Import import in imports) { |
| 710 var importedBuilder = import.imported; |
| 711 Library importedLibrary; |
| 712 if (importedBuilder is DillLibraryBuilder) { |
| 713 importedLibrary = importedBuilder.library; |
| 714 } else if (importedBuilder is KernelLibraryBuilder) { |
| 715 importedLibrary = importedBuilder.library; |
| 716 } |
| 717 if (importedLibrary != null) { |
| 718 library.addDependency( |
| 719 new LibraryDependency.import(importedLibrary, name: import.prefix)); |
| 720 } |
| 721 } |
707 library.name = name; | 722 library.name = name; |
708 library.procedures.sort(compareProcedures); | 723 library.procedures.sort(compareProcedures); |
709 return library; | 724 return library; |
710 } | 725 } |
711 | 726 |
712 @override | 727 @override |
713 Builder buildAmbiguousBuilder( | 728 Builder buildAmbiguousBuilder( |
714 String name, Builder builder, Builder other, int charOffset, | 729 String name, Builder builder, Builder other, int charOffset, |
715 {bool isExport: false, bool isImport: false}) { | 730 {bool isExport: false, bool isImport: false}) { |
716 // TODO(ahe): Can I move this to Scope or Prefix? | 731 // TODO(ahe): Can I move this to Scope or Prefix? |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 mixinApplicationClasses.putIfAbsent(name, () => builder); | 885 mixinApplicationClasses.putIfAbsent(name, () => builder); |
871 if (existing != builder) { | 886 if (existing != builder) { |
872 part.scope.local.remove(name); | 887 part.scope.local.remove(name); |
873 } | 888 } |
874 }); | 889 }); |
875 super.includePart(part); | 890 super.includePart(part); |
876 nativeMethods.addAll(part.nativeMethods); | 891 nativeMethods.addAll(part.nativeMethods); |
877 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 892 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
878 } | 893 } |
879 } | 894 } |
OLD | NEW |