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

Unified Diff: lib/type_propagation/builder.dart

Issue 2502343002: Store named parameters in sorted lists instead of using maps. (Closed)
Patch Set: Remove duplicates from named parameter lists to recover from erroneous inputs 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 | « lib/type_environment.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/type_propagation/builder.dart
diff --git a/lib/type_propagation/builder.dart b/lib/type_propagation/builder.dart
index ca1913608c26183d31b98db2d37e168cbee5bc63..f33e12e90dc219936b01a51af435c40b515dbd02 100644
--- a/lib/type_propagation/builder.dart
+++ b/lib/type_propagation/builder.dart
@@ -1836,11 +1836,12 @@ class CovariantExternalTypeVisitor extends DartTypeVisitor<int> {
int argument = environment.getLoad(function, field);
visitContravariant(node.positionalParameters[i], argument);
}
- node.namedParameters.forEach((String name, DartType type) {
- int field = fieldNames.getNamedParameterField(arity, name);
+ for (int i = 0; i < node.namedParameters.length; ++i) {
+ var parameter = node.namedParameters[i];
+ int field = fieldNames.getNamedParameterField(arity, parameter.name);
int argument = environment.getLoad(function, field);
- visitContravariant(type, argument);
- });
+ visitContravariant(parameter.type, argument);
+ }
int returnVariable = visit(node.returnType);
environment.addStore(
function, fieldNames.getReturnField(arity), returnVariable);
@@ -1934,13 +1935,13 @@ class ContravariantExternalTypeVisitor extends DartTypeVisitor<Null> {
environment.addStore(input, field, argument);
}
}
- node.namedParameters.forEach((String name, DartType type) {
- int argument = visitCovariant(type);
+ for (var parameter in node.namedParameters) {
+ int argument = visitCovariant(parameter.type);
for (int arity = minArity; arity <= maxArity; ++arity) {
- int field = fieldNames.getNamedParameterField(arity, name);
+ int field = fieldNames.getNamedParameterField(arity, parameter.name);
environment.addStore(input, field, argument);
}
- });
+ }
for (int arity = minArity; arity <= maxArity; ++arity) {
int returnLocation =
environment.getLoad(input, fieldNames.getReturnField(arity));
« no previous file with comments | « lib/type_environment.dart ('k') | lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698