| OLD | NEW |
| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 UnaryOperator unaryOperator; | 215 UnaryOperator unaryOperator; |
| 216 BinaryOperator binaryOperator; | 216 BinaryOperator binaryOperator; |
| 217 IncDecOperator incDecOperator; | 217 IncDecOperator incDecOperator; |
| 218 | 218 |
| 219 if (node.isOperator) { | 219 if (node.isOperator) { |
| 220 String operatorText = node.selector.asOperator().source; | 220 String operatorText = node.selector.asOperator().source; |
| 221 if (operatorText == 'is') { | 221 if (operatorText == 'is') { |
| 222 return internalError(node, "Unexpected is test."); | 222 return internalError(node, "Unexpected is test."); |
| 223 } else if (operatorText == 'as') { | 223 } else if (operatorText == 'as') { |
| 224 return internalError(node, "Unexpected as cast."); | 224 return internalError(node, "Unexpected as cast."); |
| 225 return new AsStructure(elements.getType(node.arguments.single)); | |
| 226 } else if (operatorText == '&&') { | 225 } else if (operatorText == '&&') { |
| 227 return internalError(node, "Unexpected logical and."); | 226 return internalError(node, "Unexpected logical and."); |
| 228 return const LogicalAndStructure(); | |
| 229 } else if (operatorText == '||') { | 227 } else if (operatorText == '||') { |
| 230 return internalError(node, "Unexpected logical or."); | 228 return internalError(node, "Unexpected logical or."); |
| 231 } | 229 } |
| 232 } | 230 } |
| 233 | 231 |
| 234 SendStructureKind kind; | 232 SendStructureKind kind; |
| 235 | 233 |
| 236 if (node.asSendSet() != null) { | 234 if (node.asSendSet() != null) { |
| 237 SendSet sendSet = node.asSendSet(); | 235 SendSet sendSet = node.asSendSet(); |
| 238 String operatorText = sendSet.assignmentOperator.source; | 236 String operatorText = sendSet.assignmentOperator.source; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // TODO(johnniwinther): Should local function also be handled here? | 348 // TODO(johnniwinther): Should local function also be handled here? |
| 351 if (!selector.callStructure.signatureApplies(semantics.element)) { | 349 if (!selector.callStructure.signatureApplies(semantics.element)) { |
| 352 return new IncompatibleInvokeStructure(semantics, selector); | 350 return new IncompatibleInvokeStructure(semantics, selector); |
| 353 } | 351 } |
| 354 break; | 352 break; |
| 355 default: | 353 default: |
| 356 break; | 354 break; |
| 357 } | 355 } |
| 358 return new InvokeStructure(semantics, selector); | 356 return new InvokeStructure(semantics, selector); |
| 359 case SendStructureKind.UNARY: | 357 case SendStructureKind.UNARY: |
| 360 return new UnaryStructure(semantics, unaryOperator, selector); | 358 return internalError(node, "Unexpected unary."); |
| 361 case SendStructureKind.NOT: | 359 case SendStructureKind.NOT: |
| 362 assert(selector == null); | 360 return internalError(node, "Unexpected not."); |
| 363 return new NotStructure(semantics, selector); | |
| 364 case SendStructureKind.BINARY: | 361 case SendStructureKind.BINARY: |
| 365 return new BinaryStructure(semantics, binaryOperator, selector); | 362 return internalError(node, "Unexpected binary."); |
| 366 case SendStructureKind.INDEX: | 363 case SendStructureKind.INDEX: |
| 367 return new IndexStructure(semantics, selector); | 364 return internalError(node, "Unexpected index."); |
| 368 case SendStructureKind.EQ: | 365 case SendStructureKind.EQ: |
| 369 return new EqualsStructure(semantics, selector); | 366 return internalError(node, "Unexpected equals."); |
| 370 case SendStructureKind.NOT_EQ: | 367 case SendStructureKind.NOT_EQ: |
| 371 return new NotEqualsStructure(semantics, selector); | 368 return internalError(node, "Unexpected not equals."); |
| 372 case SendStructureKind.COMPOUND: | 369 case SendStructureKind.COMPOUND: |
| 373 Selector getterSelector = | 370 Selector getterSelector = |
| 374 elements.getGetterSelectorInComplexSendSet(node); | 371 elements.getGetterSelectorInComplexSendSet(node); |
| 375 return new CompoundStructure( | 372 return new CompoundStructure( |
| 376 semantics, | 373 semantics, |
| 377 assignmentOperator, | 374 assignmentOperator, |
| 378 getterSelector, | 375 getterSelector, |
| 379 selector); | 376 selector); |
| 380 case SendStructureKind.INDEX_SET: | 377 case SendStructureKind.INDEX_SET: |
| 381 return new IndexSetStructure(semantics, selector); | 378 return new IndexSetStructure(semantics, selector); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 return internalError(node, "Unexpected variable $element."); | 932 return internalError(node, "Unexpected variable $element."); |
| 936 } | 933 } |
| 937 if (element.isConst) { | 934 if (element.isConst) { |
| 938 ConstantExpression constant = elements.getConstant(element.initializer); | 935 ConstantExpression constant = elements.getConstant(element.initializer); |
| 939 return new ConstantVariableStructure(kind, node, element, constant); | 936 return new ConstantVariableStructure(kind, node, element, constant); |
| 940 } else { | 937 } else { |
| 941 return new NonConstantVariableStructure(kind, node, element); | 938 return new NonConstantVariableStructure(kind, node, element); |
| 942 } | 939 } |
| 943 } | 940 } |
| 944 } | 941 } |
| OLD | NEW |