| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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)) { |
| 200 if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) { | 205 return internalError(node, "Unexpected assert."); |
| 201 return const AssertStructure(); | |
| 202 } else { | |
| 203 return const InvalidAssertStructure(); | |
| 204 } | |
| 205 } | 206 } |
| 206 | 207 |
| 207 AssignmentOperator assignmentOperator; | 208 AssignmentOperator assignmentOperator; |
| 208 UnaryOperator unaryOperator; | 209 UnaryOperator unaryOperator; |
| 209 BinaryOperator binaryOperator; | 210 BinaryOperator binaryOperator; |
| 210 IncDecOperator incDecOperator; | 211 IncDecOperator incDecOperator; |
| 211 | 212 |
| 212 if (node.isOperator) { | 213 if (node.isOperator) { |
| 213 String operatorText = node.selector.asOperator().source; | 214 String operatorText = node.selector.asOperator().source; |
| 214 if (operatorText == 'is') { | 215 if (operatorText == 'is') { |
| 215 if (node.isIsNotCheck) { | 216 return internalError(node, "Unexpected is test."); |
| 216 return new IsNotStructure( | |
| 217 elements.getType(node.arguments.single.asSend().receiver)); | |
| 218 } else { | |
| 219 return new IsStructure(elements.getType(node.arguments.single)); | |
| 220 } | |
| 221 } else if (operatorText == 'as') { | 217 } else if (operatorText == 'as') { |
| 218 return internalError(node, "Unexpected as cast."); |
| 222 return new AsStructure(elements.getType(node.arguments.single)); | 219 return new AsStructure(elements.getType(node.arguments.single)); |
| 223 } else if (operatorText == '&&') { | 220 } else if (operatorText == '&&') { |
| 221 return internalError(node, "Unexpected logical and."); |
| 224 return const LogicalAndStructure(); | 222 return const LogicalAndStructure(); |
| 225 } else if (operatorText == '||') { | 223 } else if (operatorText == '||') { |
| 226 return const LogicalOrStructure(); | 224 return internalError(node, "Unexpected logical or."); |
| 227 } | 225 } |
| 228 } | 226 } |
| 229 | 227 |
| 230 SendStructureKind kind; | 228 SendStructureKind kind; |
| 231 | 229 |
| 232 if (node.asSendSet() != null) { | 230 if (node.asSendSet() != null) { |
| 233 SendSet sendSet = node.asSendSet(); | 231 SendSet sendSet = node.asSendSet(); |
| 234 String operatorText = sendSet.assignmentOperator.source; | 232 String operatorText = sendSet.assignmentOperator.source; |
| 235 if (sendSet.isPrefix || sendSet.isPostfix) { | 233 if (sendSet.isPrefix || sendSet.isPostfix) { |
| 236 kind = sendSet.isPrefix | 234 kind = sendSet.isPrefix |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 return internalError(node, "Unexpected variable $element."); | 929 return internalError(node, "Unexpected variable $element."); |
| 932 } | 930 } |
| 933 if (element.isConst) { | 931 if (element.isConst) { |
| 934 ConstantExpression constant = elements.getConstant(element.initializer); | 932 ConstantExpression constant = elements.getConstant(element.initializer); |
| 935 return new ConstantVariableStructure(kind, node, element, constant); | 933 return new ConstantVariableStructure(kind, node, element, constant); |
| 936 } else { | 934 } else { |
| 937 return new NonConstantVariableStructure(kind, node, element); | 935 return new NonConstantVariableStructure(kind, node, element); |
| 938 } | 936 } |
| 939 } | 937 } |
| 940 } | 938 } |
| OLD | NEW |