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

Unified Diff: lib/type_environment.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_algebra.dart ('k') | lib/type_propagation/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/type_environment.dart
diff --git a/lib/type_environment.dart b/lib/type_environment.dart
index 96f6a21a5f9847f98b411e8716f46199fb4ba589..c354c44b7048b5bac5aa22f4942d0b7e57ac3588 100644
--- a/lib/type_environment.dart
+++ b/lib/type_environment.dart
@@ -206,12 +206,17 @@ abstract class SubtypeTester {
return false;
}
}
- for (String name in supertype.namedParameters.keys) {
- var supertypeParameter = supertype.namedParameters[name];
- var subtypeParameter = subtype.namedParameters[name];
- if (subtypeParameter == null) return false;
+ int subtypeNameIndex = 0;
+ for (NamedType supertypeParameter in supertype.namedParameters) {
+ while (subtypeNameIndex < subtype.namedParameters.length &&
+ subtype.namedParameters[subtypeNameIndex].name !=
+ supertypeParameter.name) {
+ ++subtypeNameIndex;
+ }
+ if (subtypeNameIndex == subtype.namedParameters.length) return false;
+ NamedType subtypeParameter = subtype.namedParameters[subtypeNameIndex];
// Termination: Both types shrink in size.
- if (!isSubtypeOf(supertypeParameter, subtypeParameter)) {
+ if (!isSubtypeOf(supertypeParameter.type, subtypeParameter.type)) {
return false;
}
}
« no previous file with comments | « lib/type_algebra.dart ('k') | lib/type_propagation/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698