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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 // TODO(scheglov): Add support for annotations, see | 778 // TODO(scheglov): Add support for annotations, see |
777 // https://github.com/dart-lang/sdk/issues/30284. | 779 // https://github.com/dart-lang/sdk/issues/30284. |
778 String fileUri = part.fileUri.toString(); | 780 String fileUri = part.fileUri.toString(); |
779 library.addPart(new LibraryPart(<Expression>[], fileUri)); | 781 library.addPart(new LibraryPart(<Expression>[], fileUri)); |
780 } | 782 } |
781 | 783 |
782 library.name = name; | 784 library.name = name; |
783 library.procedures.sort(compareProcedures); | 785 library.procedures.sort(compareProcedures); |
784 | 786 |
785 if (additionalExports != null) { | 787 if (additionalExports != null) { |
786 library.additionalExports.addAll(additionalExports); | 788 library.addMember(new Field(new Name("_exports#", library), |
| 789 initializer: new StringLiteral(JSON.encode(additionalExports)), |
| 790 isStatic: true, |
| 791 isConst: true)); |
787 } | 792 } |
788 | 793 |
789 return library; | 794 return library; |
790 } | 795 } |
791 | 796 |
792 @override | 797 @override |
793 Builder buildAmbiguousBuilder( | 798 Builder buildAmbiguousBuilder( |
794 String name, Builder builder, Builder other, int charOffset, | 799 String name, Builder builder, Builder other, int charOffset, |
795 {bool isExport: false, bool isImport: false}) { | 800 {bool isExport: false, bool isImport: false}) { |
796 // TODO(ahe): Can I move this to Scope or Prefix? | 801 // TODO(ahe): Can I move this to Scope or Prefix? |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 mixinApplicationClasses.putIfAbsent(name, () => builder); | 955 mixinApplicationClasses.putIfAbsent(name, () => builder); |
951 if (existing != builder) { | 956 if (existing != builder) { |
952 part.scope.local.remove(name); | 957 part.scope.local.remove(name); |
953 } | 958 } |
954 }); | 959 }); |
955 super.includePart(part); | 960 super.includePart(part); |
956 nativeMethods.addAll(part.nativeMethods); | 961 nativeMethods.addAll(part.nativeMethods); |
957 boundlessTypeVariables.addAll(part.boundlessTypeVariables); | 962 boundlessTypeVariables.addAll(part.boundlessTypeVariables); |
958 } | 963 } |
959 } | 964 } |
OLD | NEW |