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

Side by Side Diff: pkg/compiler/lib/src/resolution/send_resolver.dart

Issue 1149973004: Start to compute SendStructure in resolution. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months 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 | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 4
5 part of dart2js.semantics_visitor; 5 part of dart2js.semantics_visitor;
6 6
7 enum SendStructureKind { 7 enum SendStructureKind {
8 GET, 8 GET,
9 SET, 9 SET,
10 INVOKE, 10 INVOKE,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } else { 189 } else {
190 return new StaticAccess.topLevelMethod(element); 190 return new StaticAccess.topLevelMethod(element);
191 } 191 }
192 } else { 192 } else {
193 return internalError( 193 return internalError(
194 node, "Unhandled resolved property access: $element"); 194 node, "Unhandled resolved property access: $element");
195 } 195 }
196 } 196 }
197 197
198 SendStructure computeSendStructure(Send node) { 198 SendStructure computeSendStructure(Send node) {
199 SendStructure sendStructure = elements.getSendStructure(node);
200 if (sendStructure != null) {
201 return sendStructure;
202 }
203
199 if (elements.isAssert(node)) { 204 if (elements.isAssert(node)) {
205 assert(invariant(node, false, message: "Unexpected assert."));
karlklose 2015/05/22 10:08:36 Shouldn't we always throw instead of creating stru
Johnni Winther 2015/05/22 12:24:58 Done.
200 if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) { 206 if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) {
201 return const AssertStructure(); 207 return const AssertStructure();
202 } else { 208 } else {
203 return const InvalidAssertStructure(); 209 return const InvalidAssertStructure();
204 } 210 }
205 } 211 }
206 212
207 AssignmentOperator assignmentOperator; 213 AssignmentOperator assignmentOperator;
208 UnaryOperator unaryOperator; 214 UnaryOperator unaryOperator;
209 BinaryOperator binaryOperator; 215 BinaryOperator binaryOperator;
210 IncDecOperator incDecOperator; 216 IncDecOperator incDecOperator;
211 217
212 if (node.isOperator) { 218 if (node.isOperator) {
213 String operatorText = node.selector.asOperator().source; 219 String operatorText = node.selector.asOperator().source;
214 if (operatorText == 'is') { 220 if (operatorText == 'is') {
221 assert(invariant(node, false, message: "Unexpected is test."));
215 if (node.isIsNotCheck) { 222 if (node.isIsNotCheck) {
216 return new IsNotStructure( 223 return new IsNotStructure(
217 elements.getType(node.arguments.single.asSend().receiver)); 224 elements.getType(node.arguments.single.asSend().receiver));
218 } else { 225 } else {
219 return new IsStructure(elements.getType(node.arguments.single)); 226 return new IsStructure(elements.getType(node.arguments.single));
220 } 227 }
221 } else if (operatorText == 'as') { 228 } else if (operatorText == 'as') {
229 assert(invariant(node, false, message: "Unexpected as cast."));
222 return new AsStructure(elements.getType(node.arguments.single)); 230 return new AsStructure(elements.getType(node.arguments.single));
223 } else if (operatorText == '&&') { 231 } else if (operatorText == '&&') {
232 assert(invariant(node, false, message: "Unexpected logical and."));
224 return const LogicalAndStructure(); 233 return const LogicalAndStructure();
225 } else if (operatorText == '||') { 234 } else if (operatorText == '||') {
235 assert(invariant(node, false, message: "Unexpected logical or."));
226 return const LogicalOrStructure(); 236 return const LogicalOrStructure();
227 } 237 }
228 } 238 }
229 239
230 SendStructureKind kind; 240 SendStructureKind kind;
231 241
232 if (node.asSendSet() != null) { 242 if (node.asSendSet() != null) {
233 SendSet sendSet = node.asSendSet(); 243 SendSet sendSet = node.asSendSet();
234 String operatorText = sendSet.assignmentOperator.source; 244 String operatorText = sendSet.assignmentOperator.source;
235 if (sendSet.isPrefix || sendSet.isPostfix) { 245 if (sendSet.isPrefix || sendSet.isPostfix) {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 return internalError(node, "Unexpected variable $element."); 941 return internalError(node, "Unexpected variable $element.");
932 } 942 }
933 if (element.isConst) { 943 if (element.isConst) {
934 ConstantExpression constant = elements.getConstant(element.initializer); 944 ConstantExpression constant = elements.getConstant(element.initializer);
935 return new ConstantVariableStructure(kind, node, element, constant); 945 return new ConstantVariableStructure(kind, node, element, constant);
936 } else { 946 } else {
937 return new NonConstantVariableStructure(kind, node, element); 947 return new NonConstantVariableStructure(kind, node, element);
938 } 948 }
939 } 949 }
940 } 950 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/resolution.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698