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 library dart2js.send_structure; | 5 library dart2js.send_structure; |
6 | 6 |
7 import 'access_semantics.dart'; | 7 import 'access_semantics.dart'; |
8 import 'operators.dart'; | 8 import 'operators.dart'; |
9 import 'semantic_visitor.dart'; | 9 import 'semantic_visitor.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 final Selector selector; | 168 final Selector selector; |
169 | 169 |
170 /// The [CallStructure] of the invocation. | 170 /// The [CallStructure] of the invocation. |
171 // TODO(johnniwinther): Store this directly for static invocations. | 171 // TODO(johnniwinther): Store this directly for static invocations. |
172 CallStructure get callStructure => selector.callStructure; | 172 CallStructure get callStructure => selector.callStructure; |
173 | 173 |
174 InvokeStructure(this.semantics, this.selector); | 174 InvokeStructure(this.semantics, this.selector); |
175 | 175 |
176 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 176 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
177 switch (semantics.kind) { | 177 switch (semantics.kind) { |
178 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
179 return visitor.visitIfNotNullDynamicPropertyInvoke( | |
180 node, | |
181 node.receiver, | |
182 node.argumentsNode, | |
183 selector, | |
184 arg); | |
185 case AccessKind.DYNAMIC_PROPERTY: | 178 case AccessKind.DYNAMIC_PROPERTY: |
| 179 if (node.isConditional) { |
| 180 return visitor.visitIfNotNullDynamicPropertyInvoke( |
| 181 node, |
| 182 node.receiver, |
| 183 node.argumentsNode, |
| 184 selector, |
| 185 arg); |
| 186 } |
186 return visitor.visitDynamicPropertyInvoke( | 187 return visitor.visitDynamicPropertyInvoke( |
187 node, | 188 node, |
188 node.receiver, | 189 node.receiver, |
189 node.argumentsNode, | 190 node.argumentsNode, |
190 selector, | 191 selector, |
191 arg); | 192 arg); |
192 case AccessKind.LOCAL_FUNCTION: | 193 case AccessKind.LOCAL_FUNCTION: |
193 return visitor.visitLocalFunctionInvoke( | 194 return visitor.visitLocalFunctionInvoke( |
194 node, | 195 node, |
195 semantics.element, | 196 semantics.element, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 /// The target of the read access. | 446 /// The target of the read access. |
446 final AccessSemantics semantics; | 447 final AccessSemantics semantics; |
447 | 448 |
448 /// The [Selector] for the getter invocation. | 449 /// The [Selector] for the getter invocation. |
449 final Selector selector; | 450 final Selector selector; |
450 | 451 |
451 GetStructure(this.semantics, this.selector); | 452 GetStructure(this.semantics, this.selector); |
452 | 453 |
453 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 454 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
454 switch (semantics.kind) { | 455 switch (semantics.kind) { |
455 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
456 return visitor.visitIfNotNullDynamicPropertyGet( | |
457 node, | |
458 node.receiver, | |
459 selector, | |
460 arg); | |
461 case AccessKind.DYNAMIC_PROPERTY: | 456 case AccessKind.DYNAMIC_PROPERTY: |
| 457 if (node.isConditional) { |
| 458 return visitor.visitIfNotNullDynamicPropertyGet( |
| 459 node, |
| 460 node.receiver, |
| 461 selector, |
| 462 arg); |
| 463 } |
462 return visitor.visitDynamicPropertyGet( | 464 return visitor.visitDynamicPropertyGet( |
463 node, | 465 node, |
464 node.receiver, | 466 node.receiver, |
465 selector, | 467 selector, |
466 arg); | 468 arg); |
467 case AccessKind.LOCAL_FUNCTION: | 469 case AccessKind.LOCAL_FUNCTION: |
468 return visitor.visitLocalFunctionGet( | 470 return visitor.visitLocalFunctionGet( |
469 node, | 471 node, |
470 semantics.element, | 472 semantics.element, |
471 arg); | 473 arg); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 /// The target of the assignment. | 607 /// The target of the assignment. |
606 final AccessSemantics semantics; | 608 final AccessSemantics semantics; |
607 | 609 |
608 /// The [Selector] for the setter invocation. | 610 /// The [Selector] for the setter invocation. |
609 final Selector selector; | 611 final Selector selector; |
610 | 612 |
611 SetStructure(this.semantics, this.selector); | 613 SetStructure(this.semantics, this.selector); |
612 | 614 |
613 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 615 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
614 switch (semantics.kind) { | 616 switch (semantics.kind) { |
615 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
616 return visitor.visitIfNotNullDynamicPropertySet( | |
617 node, | |
618 node.receiver, | |
619 selector, | |
620 node.arguments.single, | |
621 arg); | |
622 case AccessKind.DYNAMIC_PROPERTY: | 617 case AccessKind.DYNAMIC_PROPERTY: |
| 618 if (node.isConditional) { |
| 619 return visitor.visitIfNotNullDynamicPropertySet( |
| 620 node, |
| 621 node.receiver, |
| 622 selector, |
| 623 node.arguments.single, |
| 624 arg); |
| 625 } |
623 return visitor.visitDynamicPropertySet( | 626 return visitor.visitDynamicPropertySet( |
624 node, | 627 node, |
625 node.receiver, | 628 node.receiver, |
626 selector, | 629 selector, |
627 node.arguments.single, | 630 node.arguments.single, |
628 arg); | 631 arg); |
629 case AccessKind.LOCAL_FUNCTION: | 632 case AccessKind.LOCAL_FUNCTION: |
630 return visitor.visitLocalFunctionSet( | 633 return visitor.visitLocalFunctionSet( |
631 node, | 634 node, |
632 semantics.element, | 635 semantics.element, |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 /// The [Selector] for the setter invocation. | 1271 /// The [Selector] for the setter invocation. |
1269 final Selector setterSelector; | 1272 final Selector setterSelector; |
1270 | 1273 |
1271 CompoundStructure(this.semantics, | 1274 CompoundStructure(this.semantics, |
1272 this.operator, | 1275 this.operator, |
1273 this.getterSelector, | 1276 this.getterSelector, |
1274 this.setterSelector); | 1277 this.setterSelector); |
1275 | 1278 |
1276 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 1279 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
1277 switch (semantics.kind) { | 1280 switch (semantics.kind) { |
1278 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
1279 return visitor.visitIfNotNullDynamicPropertyCompound( | |
1280 node, | |
1281 node.receiver, | |
1282 operator, | |
1283 node.arguments.single, | |
1284 getterSelector, | |
1285 setterSelector, | |
1286 arg); | |
1287 case AccessKind.DYNAMIC_PROPERTY: | 1281 case AccessKind.DYNAMIC_PROPERTY: |
| 1282 if (node.isConditional) { |
| 1283 return visitor.visitIfNotNullDynamicPropertyCompound( |
| 1284 node, |
| 1285 node.receiver, |
| 1286 operator, |
| 1287 node.arguments.single, |
| 1288 getterSelector, |
| 1289 setterSelector, |
| 1290 arg); |
| 1291 } |
1288 return visitor.visitDynamicPropertyCompound( | 1292 return visitor.visitDynamicPropertyCompound( |
1289 node, | 1293 node, |
1290 node.receiver, | 1294 node.receiver, |
1291 operator, | 1295 operator, |
1292 node.arguments.single, | 1296 node.arguments.single, |
1293 getterSelector, | 1297 getterSelector, |
1294 setterSelector, | 1298 setterSelector, |
1295 arg); | 1299 arg); |
1296 case AccessKind.LOCAL_FUNCTION: | 1300 case AccessKind.LOCAL_FUNCTION: |
1297 return visitor.visitLocalFunctionCompound( | 1301 return visitor.visitLocalFunctionCompound( |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 /// The [Selector] for the setter invocation. | 1698 /// The [Selector] for the setter invocation. |
1695 final Selector setterSelector; | 1699 final Selector setterSelector; |
1696 | 1700 |
1697 PrefixStructure(this.semantics, | 1701 PrefixStructure(this.semantics, |
1698 this.operator, | 1702 this.operator, |
1699 this.getterSelector, | 1703 this.getterSelector, |
1700 this.setterSelector); | 1704 this.setterSelector); |
1701 | 1705 |
1702 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 1706 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
1703 switch (semantics.kind) { | 1707 switch (semantics.kind) { |
1704 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
1705 return visitor.visitIfNotNullDynamicPropertyPrefix( | |
1706 node, | |
1707 node.receiver, | |
1708 operator, | |
1709 getterSelector, | |
1710 setterSelector, | |
1711 arg); | |
1712 case AccessKind.DYNAMIC_PROPERTY: | 1708 case AccessKind.DYNAMIC_PROPERTY: |
| 1709 if (node.isConditional) { |
| 1710 return visitor.visitIfNotNullDynamicPropertyPrefix( |
| 1711 node, |
| 1712 node.receiver, |
| 1713 operator, |
| 1714 getterSelector, |
| 1715 setterSelector, |
| 1716 arg); |
| 1717 } |
1713 return visitor.visitDynamicPropertyPrefix( | 1718 return visitor.visitDynamicPropertyPrefix( |
1714 node, | 1719 node, |
1715 node.receiver, | 1720 node.receiver, |
1716 operator, | 1721 operator, |
1717 getterSelector, | 1722 getterSelector, |
1718 setterSelector, | 1723 setterSelector, |
1719 arg); | 1724 arg); |
1720 case AccessKind.LOCAL_FUNCTION: | 1725 case AccessKind.LOCAL_FUNCTION: |
1721 return visitor.visitLocalFunctionPrefix( | 1726 return visitor.visitLocalFunctionPrefix( |
1722 node, | 1727 node, |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 /// The [Selector] for the setter invocation. | 2015 /// The [Selector] for the setter invocation. |
2011 final Selector setterSelector; | 2016 final Selector setterSelector; |
2012 | 2017 |
2013 PostfixStructure(this.semantics, | 2018 PostfixStructure(this.semantics, |
2014 this.operator, | 2019 this.operator, |
2015 this.getterSelector, | 2020 this.getterSelector, |
2016 this.setterSelector); | 2021 this.setterSelector); |
2017 | 2022 |
2018 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { | 2023 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { |
2019 switch (semantics.kind) { | 2024 switch (semantics.kind) { |
2020 case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY: | |
2021 return visitor.visitIfNotNullDynamicPropertyPostfix( | |
2022 node, | |
2023 node.receiver, | |
2024 operator, | |
2025 getterSelector, | |
2026 setterSelector, | |
2027 arg); | |
2028 case AccessKind.DYNAMIC_PROPERTY: | 2025 case AccessKind.DYNAMIC_PROPERTY: |
| 2026 if (node.isConditional) { |
| 2027 return visitor.visitIfNotNullDynamicPropertyPostfix( |
| 2028 node, |
| 2029 node.receiver, |
| 2030 operator, |
| 2031 getterSelector, |
| 2032 setterSelector, |
| 2033 arg); |
| 2034 } |
2029 return visitor.visitDynamicPropertyPostfix( | 2035 return visitor.visitDynamicPropertyPostfix( |
2030 node, | 2036 node, |
2031 node.receiver, | 2037 node.receiver, |
2032 operator, | 2038 operator, |
2033 getterSelector, | 2039 getterSelector, |
2034 setterSelector, | 2040 setterSelector, |
2035 arg); | 2041 arg); |
2036 case AccessKind.LOCAL_FUNCTION: | 2042 case AccessKind.LOCAL_FUNCTION: |
2037 return visitor.visitLocalFunctionPostfix( | 2043 return visitor.visitLocalFunctionPostfix( |
2038 node, | 2044 node, |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 ThisConstructorInvokeStructure( | 2636 ThisConstructorInvokeStructure( |
2631 this.node, this.constructor, this.callStructure); | 2637 this.node, this.constructor, this.callStructure); |
2632 | 2638 |
2633 R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) { | 2639 R dispatch(SemanticDeclarationVisitor<R, A> visitor, A arg) { |
2634 return visitor.visitThisConstructorInvoke( | 2640 return visitor.visitThisConstructorInvoke( |
2635 node, constructor, node.argumentsNode, callStructure, arg); | 2641 node, constructor, node.argumentsNode, callStructure, arg); |
2636 } | 2642 } |
2637 | 2643 |
2638 bool get isConstructorInvoke => true; | 2644 bool get isConstructorInvoke => true; |
2639 } | 2645 } |
OLD | NEW |