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

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

Issue 1001863003: Update SemanticVisitor with visitIndex, visitSuperIndex (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update analyze_unused_dart2js_test. Created 5 years, 9 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 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 '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 @override 699 @override
700 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) { 700 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) {
701 return visitor.errorUndefinedUnaryExpression( 701 return visitor.errorUndefinedUnaryExpression(
702 node, 702 node,
703 node.selector, 703 node.selector,
704 node.receiver, 704 node.receiver,
705 arg); 705 arg);
706 } 706 }
707 } 707 }
708 708
709 /// The structure for a [Send] that is an index expression, i.e. of the form
710 /// `a[b]`.
711 class IndexStructure<R, A> implements SendStructure<R, A> {
712 /// The target of the left operand.
713 final AccessSemantics semantics;
714
715 // TODO(johnniwinther): Should we store this?
716 /// The [Selector] for the `[]` invocation.
717 final Selector selector;
718
719 IndexStructure(this.semantics, this.selector);
720
721 R dispatch(SemanticSendVisitor<R, A> visitor, Send node, A arg) {
722 switch (semantics.kind) {
723 case AccessKind.DYNAMIC_PROPERTY:
724 return visitor.visitIndex(
725 node,
726 node.receiver,
727 node.arguments.single,
728 arg);
729 case AccessKind.SUPER_METHOD:
730 return visitor.visitSuperIndex(
731 node,
732 semantics.element,
733 node.arguments.single,
734 arg);
735 default:
736 // This is not a valid case.
737 break;
738 }
739 throw new SpannableAssertionFailure(node, "Invalid index: ${semantics}");
740 }
741 }
742
709 /// The structure for a [Send] that is an equals test, i.e. of the form 743 /// The structure for a [Send] that is an equals test, i.e. of the form
710 /// `a == b`. 744 /// `a == b`.
711 class EqualsStructure<R, A> implements SendStructure<R, A> { 745 class EqualsStructure<R, A> implements SendStructure<R, A> {
712 /// The target of the left operand. 746 /// The target of the left operand.
713 final AccessSemantics semantics; 747 final AccessSemantics semantics;
714 748
715 // TODO(johnniwinther): Should we store this? 749 // TODO(johnniwinther): Should we store this?
716 /// The [Selector] for the `==` invocation. 750 /// The [Selector] for the `==` invocation.
717 final Selector selector; 751 final Selector selector;
718 752
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 case AccessKind.TOPLEVEL_METHOD: 993 case AccessKind.TOPLEVEL_METHOD:
960 // TODO(johnniwinther): Handle this. 994 // TODO(johnniwinther): Handle this.
961 break; 995 break;
962 case AccessKind.TOPLEVEL_GETTER: 996 case AccessKind.TOPLEVEL_GETTER:
963 // This is not a valid case. 997 // This is not a valid case.
964 break; 998 break;
965 case AccessKind.TOPLEVEL_SETTER: 999 case AccessKind.TOPLEVEL_SETTER:
966 // This is not a valid case. 1000 // This is not a valid case.
967 break; 1001 break;
968 case AccessKind.CLASS_TYPE_LITERAL: 1002 case AccessKind.CLASS_TYPE_LITERAL:
969 return visitor.visitClassTypeLiteralCompound( 1003 return visitor.errorClassTypeLiteralCompound(
970 node, 1004 node,
971 semantics.constant, 1005 semantics.constant,
972 operator, 1006 operator,
973 node.arguments.single, 1007 node.arguments.single,
974 arg); 1008 arg);
975 case AccessKind.TYPEDEF_TYPE_LITERAL: 1009 case AccessKind.TYPEDEF_TYPE_LITERAL:
976 return visitor.visitTypedefTypeLiteralCompound( 1010 return visitor.errorTypedefTypeLiteralCompound(
977 node, 1011 node,
978 semantics.constant, 1012 semantics.constant,
979 operator, 1013 operator,
980 node.arguments.single, 1014 node.arguments.single,
981 arg); 1015 arg);
982 case AccessKind.DYNAMIC_TYPE_LITERAL: 1016 case AccessKind.DYNAMIC_TYPE_LITERAL:
983 return visitor.visitDynamicTypeLiteralCompound( 1017 return visitor.errorDynamicTypeLiteralCompound(
984 node, 1018 node,
985 semantics.constant, 1019 semantics.constant,
986 operator, 1020 operator,
987 node.arguments.single, 1021 node.arguments.single,
988 arg); 1022 arg);
989 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL: 1023 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL:
990 return visitor.visitTypeVariableTypeLiteralCompound( 1024 return visitor.errorTypeVariableTypeLiteralCompound(
991 node, 1025 node,
992 semantics.element, 1026 semantics.element,
993 operator, 1027 operator,
994 node.arguments.single, 1028 node.arguments.single,
995 arg); 1029 arg);
996 case AccessKind.EXPRESSION: 1030 case AccessKind.EXPRESSION:
997 // This is not a valid case. 1031 // This is not a valid case.
998 break; 1032 break;
999 case AccessKind.THIS: 1033 case AccessKind.THIS:
1000 // This is not a valid case. 1034 // This is not a valid case.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 case AccessKind.TOPLEVEL_METHOD: 1280 case AccessKind.TOPLEVEL_METHOD:
1247 // TODO(johnniwinther): Handle this. 1281 // TODO(johnniwinther): Handle this.
1248 break; 1282 break;
1249 case AccessKind.TOPLEVEL_GETTER: 1283 case AccessKind.TOPLEVEL_GETTER:
1250 // This is not a valid case. 1284 // This is not a valid case.
1251 break; 1285 break;
1252 case AccessKind.TOPLEVEL_SETTER: 1286 case AccessKind.TOPLEVEL_SETTER:
1253 // This is not a valid case. 1287 // This is not a valid case.
1254 break; 1288 break;
1255 case AccessKind.CLASS_TYPE_LITERAL: 1289 case AccessKind.CLASS_TYPE_LITERAL:
1256 return visitor.visitClassTypeLiteralPrefix( 1290 return visitor.errorClassTypeLiteralPrefix(
1257 node, 1291 node,
1258 semantics.constant, 1292 semantics.constant,
1259 operator, 1293 operator,
1260 arg); 1294 arg);
1261 case AccessKind.TYPEDEF_TYPE_LITERAL: 1295 case AccessKind.TYPEDEF_TYPE_LITERAL:
1262 return visitor.visitTypedefTypeLiteralPrefix( 1296 return visitor.errorTypedefTypeLiteralPrefix(
1263 node, 1297 node,
1264 semantics.constant, 1298 semantics.constant,
1265 operator, 1299 operator,
1266 arg); 1300 arg);
1267 case AccessKind.DYNAMIC_TYPE_LITERAL: 1301 case AccessKind.DYNAMIC_TYPE_LITERAL:
1268 return visitor.visitDynamicTypeLiteralPrefix( 1302 return visitor.errorDynamicTypeLiteralPrefix(
1269 node, 1303 node,
1270 semantics.constant, 1304 semantics.constant,
1271 operator, 1305 operator,
1272 arg); 1306 arg);
1273 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL: 1307 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL:
1274 return visitor.visitTypeVariableTypeLiteralPrefix( 1308 return visitor.errorTypeVariableTypeLiteralPrefix(
1275 node, 1309 node,
1276 semantics.element, 1310 semantics.element,
1277 operator, 1311 operator,
1278 arg); 1312 arg);
1279 case AccessKind.EXPRESSION: 1313 case AccessKind.EXPRESSION:
1280 // This is not a valid case. 1314 // This is not a valid case.
1281 break; 1315 break;
1282 case AccessKind.THIS: 1316 case AccessKind.THIS:
1283 // This is not a valid case. 1317 // This is not a valid case.
1284 break; 1318 break;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 case AccessKind.TOPLEVEL_METHOD: 1492 case AccessKind.TOPLEVEL_METHOD:
1459 // TODO(johnniwinther): Handle this. 1493 // TODO(johnniwinther): Handle this.
1460 break; 1494 break;
1461 case AccessKind.TOPLEVEL_GETTER: 1495 case AccessKind.TOPLEVEL_GETTER:
1462 // This is not a valid case. 1496 // This is not a valid case.
1463 break; 1497 break;
1464 case AccessKind.TOPLEVEL_SETTER: 1498 case AccessKind.TOPLEVEL_SETTER:
1465 // This is not a valid case. 1499 // This is not a valid case.
1466 break; 1500 break;
1467 case AccessKind.CLASS_TYPE_LITERAL: 1501 case AccessKind.CLASS_TYPE_LITERAL:
1468 return visitor.visitClassTypeLiteralPostfix( 1502 return visitor.errorClassTypeLiteralPostfix(
1469 node, 1503 node,
1470 semantics.constant, 1504 semantics.constant,
1471 operator, 1505 operator,
1472 arg); 1506 arg);
1473 case AccessKind.TYPEDEF_TYPE_LITERAL: 1507 case AccessKind.TYPEDEF_TYPE_LITERAL:
1474 return visitor.visitTypedefTypeLiteralPostfix( 1508 return visitor.errorTypedefTypeLiteralPostfix(
1475 node, 1509 node,
1476 semantics.constant, 1510 semantics.constant,
1477 operator, 1511 operator,
1478 arg); 1512 arg);
1479 case AccessKind.DYNAMIC_TYPE_LITERAL: 1513 case AccessKind.DYNAMIC_TYPE_LITERAL:
1480 return visitor.visitDynamicTypeLiteralPostfix( 1514 return visitor.errorDynamicTypeLiteralPostfix(
1481 node, 1515 node,
1482 semantics.constant, 1516 semantics.constant,
1483 operator, 1517 operator,
1484 arg); 1518 arg);
1485 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL: 1519 case AccessKind.TYPE_PARAMETER_TYPE_LITERAL:
1486 return visitor.visitTypeVariableTypeLiteralPostfix( 1520 return visitor.errorTypeVariableTypeLiteralPostfix(
1487 node, 1521 node,
1488 semantics.element, 1522 semantics.element,
1489 operator, 1523 operator,
1490 arg); 1524 arg);
1491 case AccessKind.EXPRESSION: 1525 case AccessKind.EXPRESSION:
1492 // This is not a valid case. 1526 // This is not a valid case.
1493 break; 1527 break;
1494 case AccessKind.THIS: 1528 case AccessKind.THIS:
1495 // This is not a valid case. 1529 // This is not a valid case.
1496 break; 1530 break;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 compoundSemantics.setter, 1625 compoundSemantics.setter,
1592 operator, 1626 operator,
1593 arg); 1627 arg);
1594 } 1628 }
1595 } 1629 }
1596 throw new SpannableAssertionFailure(node, 1630 throw new SpannableAssertionFailure(node,
1597 "Invalid compound assigment: ${semantics}"); 1631 "Invalid compound assigment: ${semantics}");
1598 } 1632 }
1599 } 1633 }
1600 1634
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/send_resolver.dart ('k') | tests/compiler/dart2js/analyze_unused_dart2js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698