Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart

Issue 1108783003: Refactor SsaBuilder.visitSuperSend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /// Interface for bulk handling of a [Node] in a semantic visitor. 7 /// Interface for bulk handling of a [Node] in a semantic visitor.
8 abstract class BulkHandle<R, A> { 8 abstract class BulkHandle<R, A> {
9 /// Handle [node] either regardless of semantics or to report that [node] is 9 /// Handle [node] either regardless of semantics or to report that [node] is
10 /// unhandled. [message] contains a message template for the latter case: 10 /// unhandled. [message] contains a message template for the latter case:
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 SendSet node, 525 SendSet node,
526 Element element, 526 Element element,
527 Node index, 527 Node index,
528 AssignmentOperator operator, 528 AssignmentOperator operator,
529 Node rhs, 529 Node rhs,
530 A arg) { 530 A arg) {
531 return bulkHandleError(node, arg); 531 return bulkHandleError(node, arg);
532 } 532 }
533 533
534 @override 534 @override
535 R errorUnresolvedSuperIndex(
536 Send node,
537 Element function,
538 Node index,
539 A arg) {
540 return bulkHandleError(node, arg);
541 }
542
543 @override
544 R errorUnresolvedSuperIndexPostfix( 535 R errorUnresolvedSuperIndexPostfix(
545 Send node, 536 Send node,
546 Element function, 537 Element function,
547 Node index, 538 Node index,
548 IncDecOperator operator, 539 IncDecOperator operator,
549 A arg) { 540 A arg) {
550 return bulkHandleError(node, arg); 541 return bulkHandleError(node, arg);
551 } 542 }
552 543
553 @override 544 @override
(...skipping 10 matching lines...) Expand all
564 R errorUnresolvedSuperIndexSet( 555 R errorUnresolvedSuperIndexSet(
565 SendSet node, 556 SendSet node,
566 Element element, 557 Element element,
567 Node index, 558 Node index,
568 Node rhs, 559 Node rhs,
569 A arg) { 560 A arg) {
570 return bulkHandleError(node, arg); 561 return bulkHandleError(node, arg);
571 } 562 }
572 563
573 @override 564 @override
574 R errorUnresolvedSuperBinary( 565 R errorUndefinedUnaryExpression(
575 Send node, 566 Send node,
576 Element element, 567 Operator operator,
577 BinaryOperator operator, 568 Node expression,
578 Node argument,
579 A arg) { 569 A arg) {
580 return bulkHandleError(node, arg); 570 return bulkHandleError(node, arg);
581 } 571 }
582
583 @override
584 R errorUnresolvedSuperUnary(
585 Send node,
586 UnaryOperator operator,
587 Element element,
588 A arg) {
589 return bulkHandleError(node, arg);
590 }
591 572
592 @override 573 @override
593 R errorUndefinedBinaryExpression( 574 R errorUndefinedBinaryExpression(
594 Send node, 575 Send node,
595 Node left, 576 Node left,
596 Operator operator, 577 Operator operator,
597 Node right, 578 Node right,
598 A arg) { 579 A arg) {
599 return bulkHandleError(node, arg); 580 return bulkHandleError(node, arg);
600 } 581 }
601
602 @override
603 R errorUndefinedUnaryExpression(
604 Send node,
605 Operator operator,
606 Node expression,
607 A arg) {
608 return bulkHandleError(node, arg);
609 }
610 } 582 }
611 583
612 /// Mixin that implements all `visitXPrefix` methods of [SemanticSendVisitor] by 584 /// Mixin that implements all `visitXPrefix` methods of [SemanticSendVisitor] by
613 /// delegating to a bulk handler. 585 /// delegating to a bulk handler.
614 /// 586 ///
615 /// Use this mixin to provide a trivial implementation for all `visitXPrefix` 587 /// Use this mixin to provide a trivial implementation for all `visitXPrefix`
616 /// methods. 588 /// methods.
617 abstract class PrefixBulkMixin<R, A> 589 abstract class PrefixBulkMixin<R, A>
618 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 590 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
619 591
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 R visitSuperMethodInvoke( 1271 R visitSuperMethodInvoke(
1300 Send node, 1272 Send node,
1301 MethodElement method, 1273 MethodElement method,
1302 NodeList arguments, 1274 NodeList arguments,
1303 CallStructure callStructure, 1275 CallStructure callStructure,
1304 A arg) { 1276 A arg) {
1305 return bulkHandleInvoke(node, arg); 1277 return bulkHandleInvoke(node, arg);
1306 } 1278 }
1307 1279
1308 @override 1280 @override
1281 R visitSuperMethodIncompatibleInvoke(
1282 Send node,
1283 MethodElement method,
1284 NodeList arguments,
1285 CallStructure callStructure,
1286 A arg) {
1287 return bulkHandleInvoke(node, arg);
1288 }
1289
1290 @override
1309 R visitThisInvoke( 1291 R visitThisInvoke(
1310 Send node, 1292 Send node,
1311 NodeList arguments, 1293 NodeList arguments,
1312 CallStructure callStructure, 1294 CallStructure callStructure,
1313 A arg) { 1295 A arg) {
1314 return bulkHandleInvoke(node, arg); 1296 return bulkHandleInvoke(node, arg);
1315 } 1297 }
1316 1298
1317 @override 1299 @override
1318 R visitThisPropertyInvoke( 1300 R visitThisPropertyInvoke(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 1357
1376 @override 1358 @override
1377 R visitConstantInvoke( 1359 R visitConstantInvoke(
1378 Send node, 1360 Send node,
1379 ConstantExpression constant, 1361 ConstantExpression constant,
1380 NodeList arguments, 1362 NodeList arguments,
1381 CallStructure callStructure, 1363 CallStructure callStructure,
1382 A arg) { 1364 A arg) {
1383 return bulkHandleInvoke(node, arg); 1365 return bulkHandleInvoke(node, arg);
1384 } 1366 }
1367
1368 @override
1369 R visitUnresolvedSuperInvoke(
1370 Send node,
1371 Element function,
1372 NodeList arguments,
1373 Selector selector,
1374 A arg) {
1375 return bulkHandleInvoke(node, arg);
1376 }
1385 } 1377 }
1386 1378
1387 /// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by 1379 /// Mixin that implements all `visitXGet` methods of [SemanticSendVisitor] by
1388 /// delegating to a bulk handler. 1380 /// delegating to a bulk handler.
1389 /// 1381 ///
1390 /// Use this mixin to provide a trivial implementation for all `visitXGet` 1382 /// Use this mixin to provide a trivial implementation for all `visitXGet`
1391 /// methods. 1383 /// methods.
1392 abstract class GetBulkMixin<R, A> 1384 abstract class GetBulkMixin<R, A>
1393 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 1385 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
1394 1386
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 return bulkHandleGet(node, arg); 1538 return bulkHandleGet(node, arg);
1547 } 1539 }
1548 1540
1549 @override 1541 @override
1550 R visitConstantGet( 1542 R visitConstantGet(
1551 Send node, 1543 Send node,
1552 ConstantExpression constant, 1544 ConstantExpression constant,
1553 A arg) { 1545 A arg) {
1554 return bulkHandleGet(node, arg); 1546 return bulkHandleGet(node, arg);
1555 } 1547 }
1548
1549 @override
1550 R visitUnresolvedSuperGet(
1551 Send node,
1552 Element element,
1553 A arg) {
1554 return bulkHandleGet(node, arg);
1555 }
1556 } 1556 }
1557 1557
1558 /// Mixin that implements all `visitXSet` methods of [SemanticSendVisitor] by 1558 /// Mixin that implements all `visitXSet` methods of [SemanticSendVisitor] by
1559 /// delegating to a bulk handler. 1559 /// delegating to a bulk handler.
1560 /// 1560 ///
1561 /// Use this mixin to provide a trivial implementation for all `visitXSet` 1561 /// Use this mixin to provide a trivial implementation for all `visitXSet`
1562 /// methods. 1562 /// methods.
1563 abstract class SetBulkMixin<R, A> 1563 abstract class SetBulkMixin<R, A>
1564 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 1564 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
1565 1565
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 } 1793 }
1794 1794
1795 @override 1795 @override
1796 R visitSuperIndex( 1796 R visitSuperIndex(
1797 Send node, 1797 Send node,
1798 FunctionElement function, 1798 FunctionElement function,
1799 Node index, 1799 Node index,
1800 A arg) { 1800 A arg) {
1801 return bulkHandleBinary(node, arg); 1801 return bulkHandleBinary(node, arg);
1802 } 1802 }
1803
1804 @override
1805 R visitUnresolvedSuperBinary(
1806 Send node,
1807 FunctionElement function,
1808 BinaryOperator operator,
1809 Node argument,
1810 A arg) {
1811 return bulkHandleBinary(node, arg);
1812 }
1813
1814 @override
1815 R visitUnresolvedSuperInvoke(
1816 Send node,
1817 Element function,
1818 NodeList arguments,
1819 Selector selector,
1820 A arg) {
1821 return bulkHandleBinary(node, arg);
1822 }
1823
1824 @override
1825 R visitUnresolvedSuperIndex(
1826 Send node,
1827 FunctionElement function,
1828 Node index,
1829 A arg) {
1830 return bulkHandleBinary(node, arg);
1831 }
1803 } 1832 }
1804 1833
1805 /// Mixin that implements all unary visitor methods in [SemanticSendVisitor] by 1834 /// Mixin that implements all unary visitor methods in [SemanticSendVisitor] by
1806 /// delegating to a bulk handler. 1835 /// delegating to a bulk handler.
1807 /// 1836 ///
1808 /// Use this mixin to provide a trivial implementation for all unary visitor 1837 /// Use this mixin to provide a trivial implementation for all unary visitor
1809 /// methods. 1838 /// methods.
1810 abstract class UnaryBulkMixin<R, A> 1839 abstract class UnaryBulkMixin<R, A>
1811 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 1840 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
1812 1841
1813 R bulkHandleUnary(Send node, A arg) { 1842 R bulkHandleUnary(Send node, A arg) {
1814 return bulkHandleNode(node, "Unary expression `#` unhandled.", arg); 1843 return bulkHandleNode(node, "Unary expression `#` unhandled.", arg);
1815 } 1844 }
1816 1845
1817 @override 1846 @override
1818 R visitNot( 1847 R visitNot(
1819 Send node, 1848 Send node,
1820 Node expression, 1849 Node expression,
1821 A arg) { 1850 A arg) {
1822 return bulkHandleUnary(node, arg); 1851 return bulkHandleUnary(node, arg);
1823 } 1852 }
1824 1853
1825 @override 1854 @override
1826 R visitSuperUnary(Send node, UnaryOperator operator, 1855 R visitSuperUnary(
1827 FunctionElement function, A arg) { 1856 Send node,
1857 UnaryOperator operator,
1858 FunctionElement function,
1859 A arg) {
1828 return bulkHandleUnary(node, arg); 1860 return bulkHandleUnary(node, arg);
1829 } 1861 }
1830 1862
1831 @override 1863 @override
1832 R visitUnary( 1864 R visitUnary(
1833 Send node, 1865 Send node,
1834 UnaryOperator operator, 1866 UnaryOperator operator,
1835 Node expression, 1867 Node expression,
1836 A arg) { 1868 A arg) {
1837 return bulkHandleUnary(node, arg); 1869 return bulkHandleUnary(node, arg);
1838 } 1870 }
1871
1872 @override
1873 R visitUnresolvedSuperUnary(
1874 Send node,
1875 UnaryOperator operator,
1876 FunctionElement function,
1877 A arg) {
1878 return bulkHandleUnary(node, arg);
1879 }
1839 } 1880 }
1840 1881
1841 /// Mixin that implements all purely structural visitor methods in 1882 /// Mixin that implements all purely structural visitor methods in
1842 /// [SemanticSendVisitor] by delegating to a bulk handler. 1883 /// [SemanticSendVisitor] by delegating to a bulk handler.
1843 /// 1884 ///
1844 /// Use this mixin to provide a trivial implementation for all purely structural 1885 /// Use this mixin to provide a trivial implementation for all purely structural
1845 /// visitor methods. 1886 /// visitor methods.
1846 abstract class BaseBulkMixin<R, A> 1887 abstract class BaseBulkMixin<R, A>
1847 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 1888 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
1848 1889
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 R visitSuperMethodInvoke( 2192 R visitSuperMethodInvoke(
2152 Send node, 2193 Send node,
2153 MethodElement method, 2194 MethodElement method,
2154 NodeList arguments, 2195 NodeList arguments,
2155 CallStructure callStructure, 2196 CallStructure callStructure,
2156 A arg) { 2197 A arg) {
2157 return bulkHandleSuper(node, arg); 2198 return bulkHandleSuper(node, arg);
2158 } 2199 }
2159 2200
2160 @override 2201 @override
2202 R visitSuperMethodIncompatibleInvoke(
2203 Send node,
2204 MethodElement method,
2205 NodeList arguments,
2206 CallStructure callStructure,
2207 A arg) {
2208 return bulkHandleSuper(node, arg);
2209 }
2210
2211 @override
2161 R visitSuperMethodSetterCompound( 2212 R visitSuperMethodSetterCompound(
2162 Send node, 2213 Send node,
2163 FunctionElement method, 2214 FunctionElement method,
2164 FunctionElement setter, 2215 FunctionElement setter,
2165 AssignmentOperator operator, 2216 AssignmentOperator operator,
2166 Node rhs, 2217 Node rhs,
2167 A arg) { 2218 A arg) {
2168 return bulkHandleSuper(node, arg); 2219 return bulkHandleSuper(node, arg);
2169 } 2220 }
2170 2221
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 } 2258 }
2208 2259
2209 @override 2260 @override
2210 R visitSuperUnary( 2261 R visitSuperUnary(
2211 Send node, 2262 Send node,
2212 UnaryOperator operator, 2263 UnaryOperator operator,
2213 FunctionElement function, 2264 FunctionElement function,
2214 A arg) { 2265 A arg) {
2215 return bulkHandleSuper(node, arg); 2266 return bulkHandleSuper(node, arg);
2216 } 2267 }
2268
2269 @override
2270 R visitUnresolvedSuperBinary(
2271 Send node,
2272 Element element,
2273 BinaryOperator operator,
2274 Node argument,
2275 A arg) {
2276 return bulkHandleSuper(node, arg);
2277 }
2278
2279 @override
2280 R visitUnresolvedSuperGet(
2281 Send node,
2282 Element element,
2283 A arg) {
2284 return bulkHandleSuper(node, arg);
2285 }
2286
2287 @override
2288 R visitUnresolvedSuperInvoke(
2289 Send node,
2290 Element function,
2291 NodeList arguments,
2292 Selector selector,
2293 A arg) {
2294 return bulkHandleSuper(node, arg);
2295 }
2296
2297 @override
2298 R visitUnresolvedSuperIndex(
2299 Send node,
2300 Element function,
2301 Node index,
2302 A arg) {
2303 return bulkHandleSuper(node, arg);
2304 }
2305
2306 @override
2307 R visitUnresolvedSuperUnary(
2308 Send node,
2309 UnaryOperator operator,
2310 Element element,
2311 A arg) {
2312 return bulkHandleSuper(node, arg);
2313 }
2217 } 2314 }
2218 2315
2219 abstract class NewBulkMixin<R, A> 2316 abstract class NewBulkMixin<R, A>
2220 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> { 2317 implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
2221 2318
2222 R bulkHandleNew(NewExpression node, A arg) { 2319 R bulkHandleNew(NewExpression node, A arg) {
2223 return bulkHandleNode( 2320 return bulkHandleNode(
2224 node, "Constructor invocation `#` unhandled.", arg); 2321 node, "Constructor invocation `#` unhandled.", arg);
2225 } 2322 }
2226 2323
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 R errorTypedefTypeLiteralSet( 3182 R errorTypedefTypeLiteralSet(
3086 SendSet node, 3183 SendSet node,
3087 ConstantExpression constant, 3184 ConstantExpression constant,
3088 Node rhs, 3185 Node rhs,
3089 A arg) { 3186 A arg) {
3090 apply(rhs, arg); 3187 apply(rhs, arg);
3091 return null; 3188 return null;
3092 } 3189 }
3093 3190
3094 @override 3191 @override
3095 R errorUnresolvedSuperIndex( 3192 R visitUnresolvedSuperIndex(
3096 Send node, 3193 Send node,
3097 Element function, 3194 Element function,
3098 Node index, 3195 Node index,
3099 A arg) { 3196 A arg) {
3100 apply(index, arg); 3197 apply(index, arg);
3101 return null; 3198 return null;
3102 } 3199 }
3103 3200
3104 @override 3201 @override
3202 R visitUnresolvedSuperGet(
3203 Send node,
3204 Element element,
3205 A arg) {
3206 return null;
3207 }
3208
3209 @override
3210 R visitUnresolvedSuperInvoke(
3211 Send node,
3212 Element function,
3213 NodeList arguments,
3214 Selector selector,
3215 A arg) {
3216 apply(arguments, arg);
3217 return null;
3218 }
3219
3220 @override
3105 R visitAs( 3221 R visitAs(
3106 Send node, 3222 Send node,
3107 Node expression, 3223 Node expression,
3108 DartType type, 3224 DartType type,
3109 A arg) { 3225 A arg) {
3110 apply(expression, arg); 3226 apply(expression, arg);
3111 return null; 3227 return null;
3112 } 3228 }
3113 3229
3114 @override 3230 @override
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 Send node, 4124 Send node,
4009 MethodElement method, 4125 MethodElement method,
4010 NodeList arguments, 4126 NodeList arguments,
4011 CallStructure callStructure, 4127 CallStructure callStructure,
4012 A arg) { 4128 A arg) {
4013 apply(arguments, arg); 4129 apply(arguments, arg);
4014 return null; 4130 return null;
4015 } 4131 }
4016 4132
4017 @override 4133 @override
4134 R visitSuperMethodIncompatibleInvoke(
4135 Send node,
4136 MethodElement method,
4137 NodeList arguments,
4138 CallStructure callStructure,
4139 A arg) {
4140 apply(arguments, arg);
4141 return null;
4142 }
4143
4144 @override
4018 R visitSuperMethodSetterCompound( 4145 R visitSuperMethodSetterCompound(
4019 Send node, 4146 Send node,
4020 FunctionElement method, 4147 FunctionElement method,
4021 FunctionElement setter, 4148 FunctionElement setter,
4022 AssignmentOperator operator, 4149 AssignmentOperator operator,
4023 Node rhs, 4150 Node rhs,
4024 A arg) { 4151 A arg) {
4025 apply(rhs, arg); 4152 apply(rhs, arg);
4026 return null; 4153 return null;
4027 } 4154 }
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
4525 Node index, 4652 Node index,
4526 AssignmentOperator operator, 4653 AssignmentOperator operator,
4527 Node rhs, 4654 Node rhs,
4528 A arg) { 4655 A arg) {
4529 apply(index, arg); 4656 apply(index, arg);
4530 apply(rhs, arg); 4657 apply(rhs, arg);
4531 return null; 4658 return null;
4532 } 4659 }
4533 4660
4534 @override 4661 @override
4535 R errorUnresolvedSuperBinary( 4662 R visitUnresolvedSuperBinary(
4536 Send node, 4663 Send node,
4537 Element element, 4664 Element element,
4538 BinaryOperator operator, 4665 BinaryOperator operator,
4539 Node argument, 4666 Node argument,
4540 A arg) { 4667 A arg) {
4541 apply(argument, arg); 4668 apply(argument, arg);
4542 return null; 4669 return null;
4543 } 4670 }
4544 4671
4545 @override 4672 @override
4546 R errorUnresolvedSuperUnary( 4673 R visitUnresolvedSuperUnary(
4547 Send node, 4674 Send node,
4548 UnaryOperator operator, 4675 UnaryOperator operator,
4549 Element element, 4676 Element element,
4550 A arg) { 4677 A arg) {
4551 return null; 4678 return null;
4552 } 4679 }
4553 4680
4554 @override 4681 @override
4555 R errorUnresolvedSuperIndexPostfix( 4682 R errorUnresolvedSuperIndexPostfix(
4556 Send node, 4683 Send node,
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
6392 InterfaceType type, 6519 InterfaceType type,
6393 ConstructorElement effectiveTarget, 6520 ConstructorElement effectiveTarget,
6394 InterfaceType effectiveTargetType, 6521 InterfaceType effectiveTargetType,
6395 NodeList arguments, 6522 NodeList arguments,
6396 CallStructure callStructure, 6523 CallStructure callStructure,
6397 A arg) { 6524 A arg) {
6398 return handleConstructorInvoke( 6525 return handleConstructorInvoke(
6399 node, constructor, type, arguments, callStructure, arg); 6526 node, constructor, type, arguments, callStructure, arg);
6400 } 6527 }
6401 } 6528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698