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

Side by Side Diff: pkg/kernel/lib/ast.dart

Issue 2986393002: Record Typedef reference into Kernel FunctionType and resynthesyze typedefs in Analyzer. (Closed)
Patch Set: 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 /// ----------------------------------------------------------------------- 5 /// -----------------------------------------------------------------------
6 /// ERROR HANDLING 6 /// ERROR HANDLING
7 /// ----------------------------------------------------------------------- 7 /// -----------------------------------------------------------------------
8 /// 8 ///
9 /// As a rule of thumb, errors that can be detected statically are handled by 9 /// As a rule of thumb, errors that can be detected statically are handled by
10 /// the frontend, typically by translating the erroneous code into a 'throw' or 10 /// the frontend, typically by translating the erroneous code into a 'throw' or
(...skipping 4125 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 final List<TypeParameter> typeParameters; 4136 final List<TypeParameter> typeParameters;
4137 final int requiredParameterCount; 4137 final int requiredParameterCount;
4138 final List<DartType> positionalParameters; 4138 final List<DartType> positionalParameters;
4139 final List<NamedType> namedParameters; // Must be sorted. 4139 final List<NamedType> namedParameters; // Must be sorted.
4140 4140
4141 /// The optional names of [positionalParameters], not `null`, but might be 4141 /// The optional names of [positionalParameters], not `null`, but might be
4142 /// empty if information is not available. 4142 /// empty if information is not available.
4143 @informative 4143 @informative
4144 final List<String> positionalParameterNames; 4144 final List<String> positionalParameterNames;
4145 4145
4146 /// The [Typedef] this function type is created for.
4147 @informative
Paul Berry 2017/08/03 20:25:45 I think we should drop "@informative" here. I rea
scheglov 2017/08/03 21:00:32 Done.
4148 Reference typedefReference;
4149
4146 final DartType returnType; 4150 final DartType returnType;
4147 int _hashCode; 4151 int _hashCode;
4148 4152
4149 FunctionType(List<DartType> positionalParameters, this.returnType, 4153 FunctionType(List<DartType> positionalParameters, this.returnType,
4150 {this.namedParameters: const <NamedType>[], 4154 {this.namedParameters: const <NamedType>[],
4151 this.typeParameters: const <TypeParameter>[], 4155 this.typeParameters: const <TypeParameter>[],
4152 int requiredParameterCount, 4156 int requiredParameterCount,
4153 this.positionalParameterNames: const <String>[]}) 4157 this.positionalParameterNames: const <String>[],
4158 this.typedefReference})
4154 : this.positionalParameters = positionalParameters, 4159 : this.positionalParameters = positionalParameters,
4155 this.requiredParameterCount = 4160 this.requiredParameterCount =
4156 requiredParameterCount ?? positionalParameters.length; 4161 requiredParameterCount ?? positionalParameters.length;
4157 4162
4163 /// The [Typedef] this function type is created for.
4164 @informative
Paul Berry 2017/08/03 20:25:45 Also drop "@informative" here
scheglov 2017/08/03 21:00:32 Done.
4165 Typedef get typedef => typedefReference?.asTypedef;
4166
4158 accept(DartTypeVisitor v) => v.visitFunctionType(this); 4167 accept(DartTypeVisitor v) => v.visitFunctionType(this);
4159 4168
4160 visitChildren(Visitor v) { 4169 visitChildren(Visitor v) {
4161 visitList(typeParameters, v); 4170 visitList(typeParameters, v);
4162 visitList(positionalParameters, v); 4171 visitList(positionalParameters, v);
4163 visitList(namedParameters, v); 4172 visitList(namedParameters, v);
4164 returnType.accept(v); 4173 returnType.accept(v);
4165 } 4174 }
4166 4175
4167 bool operator ==(Object other) { 4176 bool operator ==(Object other) {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
4733 if (typedef_.canonicalName == null) { 4742 if (typedef_.canonicalName == null) {
4734 throw '$typedef_ has no canonical name'; 4743 throw '$typedef_ has no canonical name';
4735 } 4744 }
4736 return typedef_.canonicalName; 4745 return typedef_.canonicalName;
4737 } 4746 }
4738 4747
4739 /// Annotation describing information which is not part of Dart semantics; in 4748 /// Annotation describing information which is not part of Dart semantics; in
4740 /// other words, if this information (or any information it refers to) changes, 4749 /// other words, if this information (or any information it refers to) changes,
4741 /// static analysis and runtime behavior of the library are unaffected. 4750 /// static analysis and runtime behavior of the library are unaffected.
4742 const informative = null; 4751 const informative = null;
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart ('k') | pkg/kernel/lib/binary/ast_from_binary.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698