OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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_function_type_builder; | 5 library fasta.kernel_function_type_builder; |
6 | 6 |
7 import 'package:kernel/ast.dart' | 7 import 'package:kernel/ast.dart' |
8 show | 8 show |
9 DartType, | 9 DartType, |
10 DynamicType, | 10 DynamicType, |
11 FunctionType, | 11 FunctionType, |
12 NamedType, | 12 NamedType, |
13 Supertype, | 13 Supertype, |
14 TypeParameter; | 14 TypeParameter; |
15 | 15 |
16 import 'kernel_builder.dart' | 16 import 'kernel_builder.dart' |
17 show | 17 show |
18 FormalParameterBuilder, | 18 FormalParameterBuilder, |
19 FunctionTypeBuilder, | 19 FunctionTypeBuilder, |
20 KernelFormalParameterBuilder, | 20 KernelFormalParameterBuilder, |
21 KernelTypeBuilder, | 21 KernelTypeBuilder, |
22 KernelTypeVariableBuilder, | 22 KernelTypeVariableBuilder, |
23 LibraryBuilder, | 23 LibraryBuilder, |
24 TypeVariableBuilder; | 24 TypeVariableBuilder; |
25 | 25 |
26 class KernelFunctionTypeBuilder extends FunctionTypeBuilder | 26 class KernelFunctionTypeBuilder extends FunctionTypeBuilder |
27 implements KernelTypeBuilder { | 27 implements KernelTypeBuilder { |
| 28 final int charOffset; |
| 29 |
28 KernelFunctionTypeBuilder( | 30 KernelFunctionTypeBuilder( |
29 int charOffset, | 31 this.charOffset, |
30 Uri fileUri, | 32 Uri fileUri, |
31 KernelTypeBuilder returnType, | 33 KernelTypeBuilder returnType, |
32 List<TypeVariableBuilder> typeVariables, | 34 List<TypeVariableBuilder> typeVariables, |
33 List<FormalParameterBuilder> formals) | 35 List<FormalParameterBuilder> formals) |
34 : super(charOffset, fileUri, returnType, typeVariables, formals); | 36 : super(charOffset, fileUri, returnType, typeVariables, formals); |
35 | 37 |
36 DartType build(LibraryBuilder library) { | 38 DartType build(LibraryBuilder library) { |
37 DartType builtReturnType = | 39 DartType builtReturnType = |
38 returnType?.build(library) ?? const DynamicType(); | 40 returnType?.build(library) ?? const DynamicType(); |
39 List<DartType> positionalParameters = <DartType>[]; | 41 List<DartType> positionalParameters = <DartType>[]; |
(...skipping 27 matching lines...) Expand all Loading... |
67 requiredParameterCount: requiredParameterCount); | 69 requiredParameterCount: requiredParameterCount); |
68 } | 70 } |
69 | 71 |
70 Supertype buildSupertype(LibraryBuilder library) { | 72 Supertype buildSupertype(LibraryBuilder library) { |
71 library.addCompileTimeError( | 73 library.addCompileTimeError( |
72 charOffset, "Can't use a function type as supertype.", | 74 charOffset, "Can't use a function type as supertype.", |
73 fileUri: fileUri); | 75 fileUri: fileUri); |
74 return null; | 76 return null; |
75 } | 77 } |
76 } | 78 } |
OLD | NEW |