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

Unified Diff: lib/checks.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/binary/ast_to_binary.dart ('k') | lib/text/ast_to_text.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/checks.dart
diff --git a/lib/checks.dart b/lib/checks.dart
index 8de3b9f70d1d1cd324ced9366be718f7815601f6..a450e2f3d68f0faafdc713af95077bd6db13650f 100644
--- a/lib/checks.dart
+++ b/lib/checks.dart
@@ -75,11 +75,26 @@ class CheckReferences extends RecursiveVisitor {
}
visitFunctionNode(FunctionNode node) {
+ for (int i = 1; i < node.namedParameters.length; ++i) {
+ if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) {
+ throw 'Named parameters are not sorted on function found in $context';
+ }
+ }
typeParameters.addAll(node.typeParameters);
node.visitChildren(this);
typeParameters.removeAll(node.typeParameters);
}
+ visitFunctionType(FunctionType node) {
+ for (int i = 1; i < node.namedParameters.length; ++i) {
+ if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) {
+ throw 'Named parameters are not sorted on function type found in '
+ '$context';
+ }
+ }
+ node.visitChildren(this);
+ }
+
@override
defaultMemberReference(Member node) {
if (!members.contains(node)) {
« no previous file with comments | « lib/binary/ast_to_binary.dart ('k') | lib/text/ast_to_text.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698