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, |
(...skipping 19 matching lines...) Expand all Loading... |
30 final int charOffset; | 30 final int charOffset; |
31 | 31 |
32 KernelFunctionTypeBuilder( | 32 KernelFunctionTypeBuilder( |
33 this.charOffset, | 33 this.charOffset, |
34 Uri fileUri, | 34 Uri fileUri, |
35 KernelTypeBuilder returnType, | 35 KernelTypeBuilder returnType, |
36 List<TypeVariableBuilder> typeVariables, | 36 List<TypeVariableBuilder> typeVariables, |
37 List<FormalParameterBuilder> formals) | 37 List<FormalParameterBuilder> formals) |
38 : super(charOffset, fileUri, returnType, typeVariables, formals); | 38 : super(charOffset, fileUri, returnType, typeVariables, formals); |
39 | 39 |
40 DartType build(LibraryBuilder library) { | 40 FunctionType build(LibraryBuilder library) { |
41 DartType builtReturnType = | 41 DartType builtReturnType = |
42 returnType?.build(library) ?? const DynamicType(); | 42 returnType?.build(library) ?? const DynamicType(); |
43 List<DartType> positionalParameters = <DartType>[]; | 43 List<DartType> positionalParameters = <DartType>[]; |
44 List<String> positionalParameterNames = <String>[]; | 44 List<String> positionalParameterNames = <String>[]; |
45 List<NamedType> namedParameters; | 45 List<NamedType> namedParameters; |
46 int requiredParameterCount = 0; | 46 int requiredParameterCount = 0; |
47 if (formals != null) { | 47 if (formals != null) { |
48 for (KernelFormalParameterBuilder formal in formals) { | 48 for (KernelFormalParameterBuilder formal in formals) { |
49 DartType type = formal.type?.build(library) ?? const DynamicType(); | 49 DartType type = formal.type?.build(library) ?? const DynamicType(); |
50 if (formal.isPositional) { | 50 if (formal.isPositional) { |
(...skipping 22 matching lines...) Expand all Loading... |
73 requiredParameterCount: requiredParameterCount, | 73 requiredParameterCount: requiredParameterCount, |
74 positionalParameterNames: positionalParameterNames); | 74 positionalParameterNames: positionalParameterNames); |
75 } | 75 } |
76 | 76 |
77 Supertype buildSupertype(LibraryBuilder library) { | 77 Supertype buildSupertype(LibraryBuilder library) { |
78 library.addCompileTimeError( | 78 library.addCompileTimeError( |
79 messageSupertypeIsFunction, charOffset, fileUri); | 79 messageSupertypeIsFunction, charOffset, fileUri); |
80 return null; | 80 return null; |
81 } | 81 } |
82 } | 82 } |
OLD | NEW |