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