| 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, |
| 11 UNARY, | 11 UNARY, |
| 12 NOT, | 12 NOT, |
| 13 BINARY, | 13 BINARY, |
| 14 EQ, | 14 EQ, |
| 15 NOT_EQ, | 15 NOT_EQ, |
| 16 COMPOUND, | 16 COMPOUND, |
| 17 INDEX, |
| 17 INDEX_SET, | 18 INDEX_SET, |
| 18 COMPOUND_INDEX_SET, | 19 COMPOUND_INDEX_SET, |
| 19 PREFIX, | 20 PREFIX, |
| 20 POSTFIX, | 21 POSTFIX, |
| 21 } | 22 } |
| 22 | 23 |
| 23 abstract class SendResolverMixin { | 24 abstract class SendResolverMixin { |
| 24 TreeElements get elements; | 25 TreeElements get elements; |
| 25 | 26 |
| 26 internalError(Spannable spannable, String message); | 27 internalError(Spannable spannable, String message); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 case BinaryOperatorKind.NOT_EQ: | 180 case BinaryOperatorKind.NOT_EQ: |
| 180 if (node.isSuperCall) { | 181 if (node.isSuperCall) { |
| 181 // `super != foo` is a compile-time error. | 182 // `super != foo` is a compile-time error. |
| 182 return const InvalidBinaryStructure(); | 183 return const InvalidBinaryStructure(); |
| 183 } | 184 } |
| 184 kind = SendStructureKind.NOT_EQ; | 185 kind = SendStructureKind.NOT_EQ; |
| 185 break; | 186 break; |
| 186 case BinaryOperatorKind.INDEX: | 187 case BinaryOperatorKind.INDEX: |
| 187 if (node.arguments.tail.isEmpty) { | 188 if (node.arguments.tail.isEmpty) { |
| 188 // a[b] | 189 // a[b] |
| 189 kind = SendStructureKind.BINARY; | 190 kind = SendStructureKind.INDEX; |
| 190 } else { | 191 } else { |
| 191 if (kind == SendStructureKind.COMPOUND) { | 192 if (kind == SendStructureKind.COMPOUND) { |
| 192 // a[b] += c | 193 // a[b] += c |
| 193 kind = SendStructureKind.COMPOUND_INDEX_SET; | 194 kind = SendStructureKind.COMPOUND_INDEX_SET; |
| 194 } else { | 195 } else { |
| 195 // a[b] = c | 196 // a[b] = c |
| 196 kind = SendStructureKind.INDEX_SET; | 197 kind = SendStructureKind.INDEX_SET; |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 break; | 200 break; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 226 return new SetStructure(semantics, selector); | 227 return new SetStructure(semantics, selector); |
| 227 case SendStructureKind.INVOKE: | 228 case SendStructureKind.INVOKE: |
| 228 return new InvokeStructure(semantics, selector); | 229 return new InvokeStructure(semantics, selector); |
| 229 case SendStructureKind.UNARY: | 230 case SendStructureKind.UNARY: |
| 230 return new UnaryStructure(semantics, unaryOperator, selector); | 231 return new UnaryStructure(semantics, unaryOperator, selector); |
| 231 case SendStructureKind.NOT: | 232 case SendStructureKind.NOT: |
| 232 assert(selector == null); | 233 assert(selector == null); |
| 233 return new NotStructure(semantics, selector); | 234 return new NotStructure(semantics, selector); |
| 234 case SendStructureKind.BINARY: | 235 case SendStructureKind.BINARY: |
| 235 return new BinaryStructure(semantics, binaryOperator, selector); | 236 return new BinaryStructure(semantics, binaryOperator, selector); |
| 237 case SendStructureKind.INDEX: |
| 238 return new IndexStructure(semantics, selector); |
| 236 case SendStructureKind.EQ: | 239 case SendStructureKind.EQ: |
| 237 return new EqualsStructure(semantics, selector); | 240 return new EqualsStructure(semantics, selector); |
| 238 case SendStructureKind.NOT_EQ: | 241 case SendStructureKind.NOT_EQ: |
| 239 return new NotEqualsStructure(semantics, selector); | 242 return new NotEqualsStructure(semantics, selector); |
| 240 case SendStructureKind.COMPOUND: | 243 case SendStructureKind.COMPOUND: |
| 241 Selector getterSelector = | 244 Selector getterSelector = |
| 242 elements.getGetterSelectorInComplexSendSet(node); | 245 elements.getGetterSelectorInComplexSendSet(node); |
| 243 return new CompoundStructure( | 246 return new CompoundStructure( |
| 244 semantics, | 247 semantics, |
| 245 assignmentOperator, | 248 assignmentOperator, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // TODO(johnniwinther): Provide an [ErroneousElement]. | 368 // TODO(johnniwinther): Provide an [ErroneousElement]. |
| 366 // This happens for code like `C.this`. | 369 // This happens for code like `C.this`. |
| 367 return new StaticAccess.unresolved(null); | 370 return new StaticAccess.unresolved(null); |
| 368 } else { | 371 } else { |
| 369 return handleStaticallyResolvedAccess(node, element, getter); | 372 return handleStaticallyResolvedAccess(node, element, getter); |
| 370 } | 373 } |
| 371 } | 374 } |
| 372 } | 375 } |
| 373 } | 376 } |
| 374 | 377 |
| OLD | NEW |