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

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

Issue 2985293002: Add optional FunctionType.positionalParameterNames and use them to resynthesize function-type forma… (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 4073 matching lines...) Expand 10 before | Expand all | Expand 10 after
4084 accept(DartTypeVisitor v) => v.visitVectorType(this); 4084 accept(DartTypeVisitor v) => v.visitVectorType(this);
4085 visitChildren(Visitor v) {} 4085 visitChildren(Visitor v) {}
4086 } 4086 }
4087 4087
4088 /// A possibly generic function type. 4088 /// A possibly generic function type.
4089 class FunctionType extends DartType { 4089 class FunctionType extends DartType {
4090 final List<TypeParameter> typeParameters; 4090 final List<TypeParameter> typeParameters;
4091 final int requiredParameterCount; 4091 final int requiredParameterCount;
4092 final List<DartType> positionalParameters; 4092 final List<DartType> positionalParameters;
4093 final List<NamedType> namedParameters; // Must be sorted. 4093 final List<NamedType> namedParameters; // Must be sorted.
4094
4095 /// The optional names of [positionalParameters], might be empty, but
4096 /// not `null`.
Siggi Cherem (dart-lang) 2017/07/31 17:43:08 it might be a bit confusing if positionalParameter
scheglov 2017/07/31 20:35:30 In flatbuffers every type has default value. For l
4097 @informative
Siggi Cherem (dart-lang) 2017/07/31 17:43:07 General question about what we should do about @in
scheglov 2017/07/31 20:35:30 Well, ultimately any computation, which results we
4098 final List<String> positionalParameterNames;
4099
4094 final DartType returnType; 4100 final DartType returnType;
4095 int _hashCode; 4101 int _hashCode;
4096 4102
4097 FunctionType(List<DartType> positionalParameters, this.returnType, 4103 FunctionType(List<DartType> positionalParameters, this.returnType,
4098 {this.namedParameters: const <NamedType>[], 4104 {this.namedParameters: const <NamedType>[],
4099 this.typeParameters: const <TypeParameter>[], 4105 this.typeParameters: const <TypeParameter>[],
4100 int requiredParameterCount}) 4106 int requiredParameterCount,
4107 this.positionalParameterNames: const <String>[]})
4101 : this.positionalParameters = positionalParameters, 4108 : this.positionalParameters = positionalParameters,
4102 this.requiredParameterCount = 4109 this.requiredParameterCount =
4103 requiredParameterCount ?? positionalParameters.length; 4110 requiredParameterCount ?? positionalParameters.length;
4104 4111
4105 accept(DartTypeVisitor v) => v.visitFunctionType(this); 4112 accept(DartTypeVisitor v) => v.visitFunctionType(this);
4106 4113
4107 visitChildren(Visitor v) { 4114 visitChildren(Visitor v) {
4108 visitList(typeParameters, v); 4115 visitList(typeParameters, v);
4109 visitList(positionalParameters, v); 4116 visitList(positionalParameters, v);
4110 visitList(namedParameters, v); 4117 visitList(namedParameters, v);
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
4680 if (typedef_.canonicalName == null) { 4687 if (typedef_.canonicalName == null) {
4681 throw '$typedef_ has no canonical name'; 4688 throw '$typedef_ has no canonical name';
4682 } 4689 }
4683 return typedef_.canonicalName; 4690 return typedef_.canonicalName;
4684 } 4691 }
4685 4692
4686 /// Annotation describing information which is not part of Dart semantics; in 4693 /// Annotation describing information which is not part of Dart semantics; in
4687 /// other words, if this information (or any information it refers to) changes, 4694 /// other words, if this information (or any information it refers to) changes,
4688 /// static analysis and runtime behavior of the library are unaffected. 4695 /// static analysis and runtime behavior of the library are unaffected.
4689 const informative = null; 4696 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