Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_function_type_alias_builder.dart

Issue 2986393002: Record Typedef reference into Kernel FunctionType and resynthesyze typedefs in Analyzer. (Closed)
Patch Set: Drop @informative for typedefReference. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_function_type_alias_builder; 5 library fasta.kernel_function_type_alias_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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 DartType buildThisType(LibraryBuilder library) { 54 DartType buildThisType(LibraryBuilder library) {
55 if (thisType != null) { 55 if (thisType != null) {
56 if (const InvalidType() == thisType) { 56 if (const InvalidType() == thisType) {
57 library.addCompileTimeError( 57 library.addCompileTimeError(
58 templateCyclicTypedef.withArguments(name), charOffset, fileUri); 58 templateCyclicTypedef.withArguments(name), charOffset, fileUri);
59 return const DynamicType(); 59 return const DynamicType();
60 } 60 }
61 return thisType; 61 return thisType;
62 } 62 }
63 thisType = const InvalidType(); 63 thisType = const InvalidType();
64 DartType builtType = type?.build(library) ?? const DynamicType(); 64 FunctionType builtType = type?.build(library);
65 if (typeVariables != null) { 65 if (builtType != null) {
66 for (KernelTypeVariableBuilder tv in typeVariables) { 66 builtType.typedefReference = target.reference;
67 tv.parameter.bound = tv?.bound?.build(library); 67 if (typeVariables != null) {
68 target.typeParameters.add(tv.parameter..parent = target); 68 for (KernelTypeVariableBuilder tv in typeVariables) {
69 tv.parameter.bound = tv?.bound?.build(library);
70 target.typeParameters.add(tv.parameter..parent = target);
71 }
69 } 72 }
73 return thisType = builtType;
74 } else {
75 return thisType = const DynamicType();
70 } 76 }
71 return thisType = builtType;
72 } 77 }
73 78
74 /// [arguments] have already been built. 79 /// [arguments] have already been built.
75 DartType buildTypesWithBuiltArguments( 80 DartType buildTypesWithBuiltArguments(
76 LibraryBuilder library, List<DartType> arguments) { 81 LibraryBuilder library, List<DartType> arguments) {
77 var thisType = buildThisType(library); 82 var thisType = buildThisType(library);
78 if (const DynamicType() == thisType) return thisType; 83 if (const DynamicType() == thisType) return thisType;
79 FunctionType result = thisType; 84 FunctionType result = thisType;
80 if (target.typeParameters.isEmpty && arguments == null) return result; 85 if (target.typeParameters.isEmpty && arguments == null) return result;
81 arguments = 86 arguments =
(...skipping 15 matching lines...) Expand all
97 // Otherwise, substitute. 102 // Otherwise, substitute.
98 List<DartType> builtArguments = <DartType>[]; 103 List<DartType> builtArguments = <DartType>[];
99 if (arguments != null) { 104 if (arguments != null) {
100 for (int i = 0; i < arguments.length; i++) { 105 for (int i = 0; i < arguments.length; i++) {
101 builtArguments.add(arguments[i].build(library)); 106 builtArguments.add(arguments[i].build(library));
102 } 107 }
103 } 108 }
104 return buildTypesWithBuiltArguments(library, builtArguments); 109 return buildTypesWithBuiltArguments(library, builtArguments);
105 } 110 }
106 } 111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698