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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2527933002: Do not sort named parameters on FunctionNode. (Closed)
Patch Set: Also update functionType getter Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/lib/analyzer/ast_from_analyzer.dart ('k') | pkg/kernel/lib/checks.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 69eb1be823d984682982f037126d09ea127ec130..40a305ffae302b36811a9f499b808849372595a7 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1106,7 +1106,7 @@ class FunctionNode extends TreeNode {
List<TypeParameter> typeParameters;
int requiredParameterCount;
List<VariableDeclaration> positionalParameters;
- List<VariableDeclaration> namedParameters; // Must be sorted.
+ List<VariableDeclaration> namedParameters;
InferredValue inferredReturnValue; // May be null.
DartType returnType; // Not null.
Statement body;
@@ -1139,17 +1139,14 @@ class FunctionNode extends TreeNode {
}
FunctionType get functionType {
- Map<String, DartType> named = const <String, DartType>{};
- if (namedParameters.isNotEmpty) {
- named = <String, DartType>{};
- for (var node in namedParameters) {
- named[node.name] = node.type;
- }
- }
TreeNode parent = this.parent;
+ List<NamedType> named =
+ namedParameters.map(_getNamedTypeOfVariable).toList(growable: false);
+ named.sort();
return new FunctionType(
- positionalParameters.map(_getTypeOfVariable).toList(), returnType,
- namedParameters: namedParameters.map(_getNamedTypeOfVariable).toList(),
+ positionalParameters.map(_getTypeOfVariable).toList(growable: false),
+ returnType,
+ namedParameters: named,
typeParameters: parent is Constructor
? parent.enclosingClass.typeParameters
: typeParameters,
@@ -2973,8 +2970,7 @@ class YieldStatement extends Statement {
/// When this occurs as a statement, it must be a direct child of a [Block].
//
// DESIGN TODO: Should we remove the 'final' modifier from variables?
-class VariableDeclaration extends Statement
- implements Comparable<VariableDeclaration> {
+class VariableDeclaration extends Statement {
/// For named parameters, this is the name of the parameter. No two named
/// parameters (in the same parameter list) can have the same name.
///
@@ -3047,10 +3043,6 @@ class VariableDeclaration extends Statement
/// Returns a possibly synthesized name for this variable, consistent with
/// the names used across all [toString] calls.
String toString() => debugVariableDeclarationName(this);
-
- int compareTo(VariableDeclaration other) {
- return name.compareTo(other.name);
- }
}
/// Declaration a local function.
« no previous file with comments | « pkg/kernel/lib/analyzer/ast_from_analyzer.dart ('k') | pkg/kernel/lib/checks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698