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

Unified Diff: lib/analyzer/ast_from_analyzer.dart

Issue 2502343002: Store named parameters in sorted lists instead of using maps. (Closed)
Patch Set: Add testcase 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 | « no previous file | lib/ast.dart » ('j') | lib/ast.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/analyzer/ast_from_analyzer.dart
diff --git a/lib/analyzer/ast_from_analyzer.dart b/lib/analyzer/ast_from_analyzer.dart
index 7dfba0d46ba7b83f20852efd4d1715f6ceb319ce..5aebe1eb61df389a6c5f2f0f17d6bf27495f3f51 100644
--- a/lib/analyzer/ast_from_analyzer.dart
+++ b/lib/analyzer/ast_from_analyzer.dart
@@ -456,6 +456,9 @@ class TypeScope extends ReferenceScope {
break;
}
}
+ if (named.isNotEmpty) {
+ named.sort();
+ }
var returnType = element is ConstructorElement
? const ast.VoidType()
: buildType(element.returnType);
@@ -557,6 +560,9 @@ class ExpressionScope extends TypeScope {
break;
}
}
+ if (named.isNotEmpty) {
+ named.sort();
+ }
return new ast.FunctionNode(buildOptionalFunctionBody(body),
typeParameters: typeParameters,
positionalParameters: positional,
@@ -2150,13 +2156,14 @@ class TypeAnnotationBuilder extends GeneralizingAstVisitor<ast.DartType> {
return types.map((t) => convertType(t, boundVariables)).toList();
}
- Map<String, ast.DartType> convertTypeMap(
+ List<ast.NamedType> convertTypeMap(
Map<String, DartType> types, List<TypeParameterElement> boundVariables) {
- if (types.isEmpty) return const <String, ast.DartType>{};
- var result = <String, ast.DartType>{};
+ if (types.isEmpty) return const <ast.NamedType>[];
+ List<ast.NamedType> result = <ast.NamedType>[];
types.forEach((name, type) {
- result[name] = convertType(type, boundVariables);
+ result.add(new ast.NamedType(name, convertType(type, boundVariables)));
});
+ result.sort();
return result;
}
« no previous file with comments | « no previous file | lib/ast.dart » ('j') | lib/ast.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698