| 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:kernel/ast.dart'; | 7 import 'package:kernel/ast.dart'; |
| 8 | 8 |
| 9 import 'package:kernel/clone.dart' show | 9 import 'package:kernel/clone.dart' show |
| 10 CloneVisitor; | 10 CloneVisitor; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 TypeVariableBuilder; | 53 TypeVariableBuilder; |
| 54 | 54 |
| 55 class KernelLibraryBuilder | 55 class KernelLibraryBuilder |
| 56 extends SourceLibraryBuilder<KernelTypeBuilder, Library> { | 56 extends SourceLibraryBuilder<KernelTypeBuilder, Library> { |
| 57 final Library library; | 57 final Library library; |
| 58 | 58 |
| 59 final List<Class> mixinApplicationClasses = <Class>[]; | 59 final List<Class> mixinApplicationClasses = <Class>[]; |
| 60 | 60 |
| 61 final List<List> argumentsWithMissingDefaultValues = <List>[]; | 61 final List<List> argumentsWithMissingDefaultValues = <List>[]; |
| 62 | 62 |
| 63 KernelLibraryBuilder(Uri uri, Loader loader) | 63 KernelLibraryBuilder(Uri uri, Uri fileUri, Loader loader) |
| 64 : library = new Library(uri), | 64 : library = new Library(uri), |
| 65 super(loader); | 65 super(loader, fileUri); |
| 66 | 66 |
| 67 Uri get uri => library.importUri; | 67 Uri get uri => library.importUri; |
| 68 | 68 |
| 69 KernelTypeBuilder addInterfaceType(String name, | 69 KernelTypeBuilder addInterfaceType(String name, |
| 70 List<KernelTypeBuilder> arguments) { | 70 List<KernelTypeBuilder> arguments) { |
| 71 KernelInterfaceTypeBuilder type = | 71 KernelInterfaceTypeBuilder type = |
| 72 new KernelInterfaceTypeBuilder(name, arguments); | 72 new KernelInterfaceTypeBuilder(name, arguments); |
| 73 if (identical(name, "dynamic")) { | 73 if (identical(name, "dynamic")) { |
| 74 // TODO(ahe): Make const. | 74 // TODO(ahe): Make const. |
| 75 type.builder = new DynamicTypeBuilder(const DynamicType()); | 75 type.builder = new DynamicTypeBuilder(const DynamicType()); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } else if (builder is PrefixBuilder) { | 210 } else if (builder is PrefixBuilder) { |
| 211 // Ignored. Kernel doesn't represent prefixes. | 211 // Ignored. Kernel doesn't represent prefixes. |
| 212 } else { | 212 } else { |
| 213 internalError("Unhandled builder: ${builder.runtimeType}"); | 213 internalError("Unhandled builder: ${builder.runtimeType}"); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 Library build() { | 217 Library build() { |
| 218 super.build(); | 218 super.build(); |
| 219 library.name = name; | 219 library.name = name; |
| 220 // TODO(ahe): Set fileUri. | |
| 221 // library.fileUri = "${fileUri ?? uri}"; | |
| 222 return library; | 220 return library; |
| 223 } | 221 } |
| 224 | 222 |
| 225 Builder buildAmbiguousBuilder( | 223 Builder buildAmbiguousBuilder( |
| 226 String name, Builder builder, Builder other) { | 224 String name, Builder builder, Builder other) { |
| 227 if (builder.next == null && other.next == null) { | 225 if (builder.next == null && other.next == null) { |
| 228 if (builder.isGetter && other.isSetter) { | 226 if (builder.isGetter && other.isSetter) { |
| 229 return new MixedAccessor(builder, other); | 227 return new MixedAccessor(builder, other); |
| 230 } else if (builder.isSetter && other.isGetter) { | 228 } else if (builder.isSetter && other.isGetter) { |
| 231 return new MixedAccessor(other, builder); | 229 return new MixedAccessor(other, builder); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 270 } |
| 273 expression.value = | 271 expression.value = |
| 274 defaultArgumentFrom(names[expression.name].initializer) | 272 defaultArgumentFrom(names[expression.name].initializer) |
| 275 ..parent = expression; | 273 ..parent = expression; |
| 276 } | 274 } |
| 277 } | 275 } |
| 278 } | 276 } |
| 279 return argumentsWithMissingDefaultValues.length; | 277 return argumentsWithMissingDefaultValues.length; |
| 280 } | 278 } |
| 281 } | 279 } |
| OLD | NEW |