| 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 'dart:convert' show JSON; |
| 8 |
| 7 import 'package:front_end/src/fasta/combinator.dart' as fasta; | 9 import 'package:front_end/src/fasta/combinator.dart' as fasta; |
| 8 import 'package:front_end/src/fasta/export.dart'; | 10 import 'package:front_end/src/fasta/export.dart'; |
| 9 import 'package:front_end/src/fasta/import.dart'; | 11 import 'package:front_end/src/fasta/import.dart'; |
| 10 import 'package:kernel/ast.dart'; | 12 import 'package:kernel/ast.dart'; |
| 11 | 13 |
| 12 import 'package:kernel/clone.dart' show CloneVisitor; | 14 import 'package:kernel/clone.dart' show CloneVisitor; |
| 13 | 15 |
| 14 import '../../scanner/token.dart' show Token; | 16 import '../../scanner/token.dart' show Token; |
| 15 | 17 |
| 16 import '../fasta_codes.dart' | 18 import '../fasta_codes.dart' |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 | 775 |
| 774 for (var part in parts) { | 776 for (var part in parts) { |
| 775 // TODO(scheglov): Add support for annotations, see | 777 // TODO(scheglov): Add support for annotations, see |
| 776 // https://github.com/dart-lang/sdk/issues/30284. | 778 // https://github.com/dart-lang/sdk/issues/30284. |
| 777 String fileUri = part.fileUri.toString(); | 779 String fileUri = part.fileUri.toString(); |
| 778 library.addPart(new LibraryPart(<Expression>[], fileUri)); | 780 library.addPart(new LibraryPart(<Expression>[], fileUri)); |
| 779 } | 781 } |
| 780 | 782 |
| 781 library.name = name; | 783 library.name = name; |
| 782 library.procedures.sort(compareProcedures); | 784 library.procedures.sort(compareProcedures); |
| 785 |
| 786 if (additionalExports != null) { |
| 787 library.addMember(new Field(new Name("_exports#", library), |
| 788 initializer: new StringLiteral(JSON.encode(additionalExports)), |
| 789 isStatic: true, |
| 790 isConst: true)); |
| 791 } |
| 792 |
| 783 return library; | 793 return library; |
| 784 } | 794 } |
| 785 | 795 |
| 786 @override | 796 @override |
| 787 Builder buildAmbiguousBuilder( | 797 Builder buildAmbiguousBuilder( |
| 788 String name, Builder builder, Builder other, int charOffset, | 798 String name, Builder builder, Builder other, int charOffset, |
| 789 {bool isExport: false, bool isImport: false}) { | 799 {bool isExport: false, bool isImport: false}) { |
| 790 // TODO(ahe): Can I move this to Scope or Prefix? | 800 // TODO(ahe): Can I move this to Scope or Prefix? |
| 791 if (builder == other) return builder; | 801 if (builder == other) return builder; |
| 792 if (builder is InvalidTypeBuilder) return builder; | 802 if (builder is InvalidTypeBuilder) return builder; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 mixinApplicationClasses.putIfAbsent(name, () => builder); | 954 mixinApplicationClasses.putIfAbsent(name, () => builder); |
| 945 if (existing != builder) { | 955 if (existing != builder) { |
| 946 part.scope.local.remove(name); | 956 part.scope.local.remove(name); |
| 947 } | 957 } |
| 948 }); | 958 }); |
| 949 super.includePart(part); | 959 super.includePart(part); |
| 950 nativeMethods.addAll(part.nativeMethods); | 960 nativeMethods.addAll(part.nativeMethods); |
| 951 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 961 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
| 952 } | 962 } |
| 953 } | 963 } |
| OLD | NEW |