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