| 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_interface_type_builder; | 5 library fasta.kernel_interface_type_builder; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' show | 7 import 'package:kernel/ast.dart' show |
| 8 DartType, | 8 DartType, |
| 9 DynamicType, | 9 DynamicType, |
| 10 Supertype, | 10 Supertype, |
| 11 VoidType; | 11 VoidType; |
| 12 | 12 |
| 13 import '../errors.dart' show | 13 import '../errors.dart' show |
| 14 inputError; | 14 inputError; |
| 15 | 15 |
| 16 import 'kernel_builder.dart' show | 16 import 'kernel_builder.dart' show |
| 17 InterfaceTypeBuilder, | |
| 18 KernelClassBuilder, | 17 KernelClassBuilder, |
| 19 KernelInvalidTypeBuilder, | 18 KernelInvalidTypeBuilder, |
| 20 KernelTypeBuilder, | 19 KernelTypeBuilder, |
| 20 NamedTypeBuilder, |
| 21 TypeBuilder, | 21 TypeBuilder, |
| 22 TypeDeclarationBuilder, | 22 TypeDeclarationBuilder, |
| 23 TypeVariableBuilder; | 23 TypeVariableBuilder; |
| 24 | 24 |
| 25 // TODO(ahe): This isn't really an interface type. Find better name, for | 25 class KernelNamedTypeBuilder extends NamedTypeBuilder<KernelTypeBuilder> |
| 26 // example, KernelNamedTypeBuilder. | |
| 27 class KernelInterfaceTypeBuilder extends InterfaceTypeBuilder<KernelTypeBuilder> | |
| 28 implements KernelTypeBuilder { | 26 implements KernelTypeBuilder { |
| 29 TypeDeclarationBuilder<KernelTypeBuilder, DartType> builder; | 27 TypeDeclarationBuilder<KernelTypeBuilder, DartType> builder; |
| 30 | 28 |
| 31 KernelInterfaceTypeBuilder(String name, List<KernelTypeBuilder> arguments) | 29 KernelNamedTypeBuilder(String name, List<KernelTypeBuilder> arguments) |
| 32 : super(name, arguments); | 30 : super(name, arguments); |
| 33 | 31 |
| 34 KernelInvalidTypeBuilder buildInvalidType(String name) { | 32 KernelInvalidTypeBuilder buildInvalidType(String name) { |
| 35 // TODO(ahe): Report error somewhere. | 33 // TODO(ahe): Report error somewhere. |
| 36 print("Type not found: $name"); | 34 print("Type not found: $name"); |
| 37 return new KernelInvalidTypeBuilder(name, null); | 35 return new KernelInvalidTypeBuilder(name, null); |
| 38 } | 36 } |
| 39 | 37 |
| 40 DartType handleMissingType() { | 38 DartType handleMissingType() { |
| 41 // TODO(ahe): Fix this. | 39 // TODO(ahe): Fix this. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 int i = 0; | 76 int i = 0; |
| 79 for (KernelTypeBuilder argument in this.arguments) { | 77 for (KernelTypeBuilder argument in this.arguments) { |
| 80 KernelTypeBuilder type = argument.subst(substitution); | 78 KernelTypeBuilder type = argument.subst(substitution); |
| 81 if (type != argument) { | 79 if (type != argument) { |
| 82 arguments ??= this.arguments.toList(); | 80 arguments ??= this.arguments.toList(); |
| 83 arguments[i] = type; | 81 arguments[i] = type; |
| 84 } | 82 } |
| 85 i++; | 83 i++; |
| 86 } | 84 } |
| 87 if (arguments != null) { | 85 if (arguments != null) { |
| 88 return new KernelInterfaceTypeBuilder(name, arguments) | 86 return new KernelNamedTypeBuilder(name, arguments) |
| 89 ..builder = builder; | 87 ..builder = builder; |
| 90 } | 88 } |
| 91 } | 89 } |
| 92 return this; | 90 return this; |
| 93 } | 91 } |
| 94 } | 92 } |
| OLD | NEW |