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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 library kernel.checks; 4 library kernel.checks;
5 5
6 import 'ast.dart'; 6 import 'ast.dart';
7 7
8 void runSanityChecks(Program program) { 8 void runSanityChecks(Program program) {
9 CheckParentPointers.check(program); 9 CheckParentPointers.check(program);
10 CheckReferences.check(program); 10 CheckReferences.check(program);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 visitClass(Class node) { 69 visitClass(Class node) {
70 currentClass = node; 70 currentClass = node;
71 typeParameters.addAll(node.typeParameters); 71 typeParameters.addAll(node.typeParameters);
72 node.visitChildren(this); 72 node.visitChildren(this);
73 typeParameters.removeAll(node.typeParameters); 73 typeParameters.removeAll(node.typeParameters);
74 currentClass = null; 74 currentClass = null;
75 } 75 }
76 76
77 visitFunctionNode(FunctionNode node) { 77 visitFunctionNode(FunctionNode node) {
78 for (int i = 1; i < node.namedParameters.length; ++i) {
79 if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) {
80 throw 'Named parameters are not sorted on function found in $context';
81 }
82 }
78 typeParameters.addAll(node.typeParameters); 83 typeParameters.addAll(node.typeParameters);
79 node.visitChildren(this); 84 node.visitChildren(this);
80 typeParameters.removeAll(node.typeParameters); 85 typeParameters.removeAll(node.typeParameters);
81 } 86 }
82 87
88 visitFunctionType(FunctionType node) {
89 for (int i = 1; i < node.namedParameters.length; ++i) {
90 if (node.namedParameters[i - 1].compareTo(node.namedParameters[i]) >= 0) {
91 throw 'Named parameters are not sorted on function type found in '
92 '$context';
93 }
94 }
95 node.visitChildren(this);
96 }
97
83 @override 98 @override
84 defaultMemberReference(Member node) { 99 defaultMemberReference(Member node) {
85 if (!members.contains(node)) { 100 if (!members.contains(node)) {
86 throw 'Dangling reference to $node found in $context.\n' 101 throw 'Dangling reference to $node found in $context.\n'
87 'Parent pointer is set to ${node.parent}'; 102 'Parent pointer is set to ${node.parent}';
88 } 103 }
89 } 104 }
90 105
91 @override 106 @override
92 visitClassReference(Class node) { 107 visitClassReference(Class node) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 node.types.isEmpty) { 144 node.types.isEmpty) {
130 ++emptyArguments; 145 ++emptyArguments;
131 } 146 }
132 } 147 }
133 148
134 defaultNode(Node node) { 149 defaultNode(Node node) {
135 ++size; 150 ++size;
136 node.visitChildren(this); 151 node.visitChildren(this);
137 } 152 }
138 } 153 }
OLDNEW
« 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