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