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

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

Issue 1004683002: Refactor IrBuilder to use SemanticVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. initial comments + bug fixes 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.semantics_visitor; 5 library dart2js.semantics_visitor;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../tree/tree.dart'; 10 import '../tree/tree.dart';
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 /// or 1051 /// or
1052 /// m() { assert(expression1, expression2); } 1052 /// m() { assert(expression1, expression2); }
1053 /// 1053 ///
1054 R errorInvalidAssert( 1054 R errorInvalidAssert(
1055 Send node, 1055 Send node,
1056 NodeList arguments, 1056 NodeList arguments,
1057 A arg); 1057 A arg);
1058 1058
1059 /// Binary expression `left operator right` where [operator] is a user 1059 /// Binary expression `left operator right` where [operator] is a user
1060 /// definable operator. Binary expressions using operator `==` are handled 1060 /// definable operator. Binary expressions using operator `==` are handled
1061 /// by [visitEquals]. 1061 /// by [visitEquals] and index operations `a[b]` are handled by [visitIndex].
1062 /// 1062 ///
1063 /// For instance: 1063 /// For instance:
1064 /// add(a, b) => a + b; 1064 /// add(a, b) => a + b;
1065 /// sub(a, b) => a - b; 1065 /// sub(a, b) => a - b;
1066 /// mul(a, b) => a * b; 1066 /// mul(a, b) => a * b;
1067 /// 1067 ///
1068 R visitBinary( 1068 R visitBinary(
1069 Send node, 1069 Send node,
1070 Node left, 1070 Node left,
1071 BinaryOperator operator, 1071 BinaryOperator operator,
(...skipping 12 matching lines...) Expand all
1084 /// m(a) => super + a; 1084 /// m(a) => super + a;
1085 /// } 1085 /// }
1086 /// 1086 ///
1087 R visitSuperBinary( 1087 R visitSuperBinary(
1088 Send node, 1088 Send node,
1089 FunctionElement function, 1089 FunctionElement function,
1090 BinaryOperator operator, 1090 BinaryOperator operator,
1091 Node argument, 1091 Node argument,
1092 A arg); 1092 A arg);
1093 1093
1094 /// Index expression `receiver[index]`.
1095 ///
1096 /// For instance:
1097 /// lookup(a, b) => a[b];
1098 ///
1099 R visitIndex(
1100 Send node,
1101 Node receiver,
1102 Node index,
1103 A arg);
1104
1105 /// Index expression `super[index]` where 'operator []' is implemented on a
1106 /// superclass by [function].
1107 ///
1108 /// For instance:
1109 /// class B {
1110 /// operator [](_) => null;
1111 /// }
1112 /// class C extends B {
1113 /// m(a) => super[a];
1114 /// }
1115 ///
1116 R visitSuperIndex(
1117 Send node,
1118 FunctionElement function,
1119 Node index,
1120 A arg);
1121
1094 /// Binary expression `left == right`. 1122 /// Binary expression `left == right`.
1095 /// 1123 ///
1096 /// For instance: 1124 /// For instance:
1097 /// neq(a, b) => a != b; 1125 /// neq(a, b) => a != b;
1098 /// 1126 ///
1099 R visitNotEquals( 1127 R visitNotEquals(
1100 Send node, 1128 Send node,
1101 Node left, 1129 Node left,
1102 Node right, 1130 Node right,
1103 A arg); 1131 A arg);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 Send node, 1214 Send node,
1187 Node expression, 1215 Node expression,
1188 A arg); 1216 A arg);
1189 1217
1190 /// Index set expression `receiver[index] = rhs`. 1218 /// Index set expression `receiver[index] = rhs`.
1191 /// 1219 ///
1192 /// For instance: 1220 /// For instance:
1193 /// m(receiver, index, rhs) => receiver[index] = rhs; 1221 /// m(receiver, index, rhs) => receiver[index] = rhs;
1194 /// 1222 ///
1195 R visitIndexSet( 1223 R visitIndexSet(
1196 Send node, 1224 SendSet node,
1197 Node receiver, 1225 Node receiver,
1198 Node index, 1226 Node index,
1199 Node rhs, 1227 Node rhs,
1200 A arg); 1228 A arg);
1201 1229
1202 /// Index set expression `super[index] = rhs` where `operator []=` is defined 1230 /// Index set expression `super[index] = rhs` where `operator []=` is defined
1203 /// on a superclass by [function]. 1231 /// on a superclass by [function].
1204 /// 1232 ///
1205 /// For instance: 1233 /// For instance:
1206 /// class B { 1234 /// class B {
1207 /// operator []=(a, b) {} 1235 /// operator []=(a, b) {}
1208 /// } 1236 /// }
1209 /// class C extends B { 1237 /// class C extends B {
1210 /// m(a, b) => super[a] = b; 1238 /// m(a, b) => super[a] = b;
1211 /// } 1239 /// }
1212 /// 1240 ///
1213 R visitSuperIndexSet( 1241 R visitSuperIndexSet(
1214 Send node, 1242 SendSet node,
1215 FunctionElement function, 1243 FunctionElement function,
1216 Node index, 1244 Node index,
1217 Node rhs, 1245 Node rhs,
1218 A arg); 1246 A arg);
1219 1247
1220 /// Logical and, &&, expression with operands [left] and [right]. 1248 /// Logical and, &&, expression with operands [left] and [right].
1221 /// 1249 ///
1222 /// For instance 1250 /// For instance
1223 /// m() => left && right; 1251 /// m() => left && right;
1224 /// 1252 ///
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 Node rhs, 1664 Node rhs,
1637 A arg); 1665 A arg);
1638 1666
1639 /// Compound assignment expression of [rhs] with [operator] on a type literal 1667 /// Compound assignment expression of [rhs] with [operator] on a type literal
1640 /// for class [element]. 1668 /// for class [element].
1641 /// 1669 ///
1642 /// For instance: 1670 /// For instance:
1643 /// class C {} 1671 /// class C {}
1644 /// m(rhs) => C += rhs; 1672 /// m(rhs) => C += rhs;
1645 /// 1673 ///
1646 R visitClassTypeLiteralCompound( 1674 R errorClassTypeLiteralCompound(
1647 Send node, 1675 Send node,
1648 TypeConstantExpression constant, 1676 TypeConstantExpression constant,
1649 AssignmentOperator operator, 1677 AssignmentOperator operator,
1650 Node rhs, 1678 Node rhs,
1651 A arg); 1679 A arg);
1652 1680
1653 /// Compound assignment expression of [rhs] with [operator] on a type literal 1681 /// Compound assignment expression of [rhs] with [operator] on a type literal
1654 /// for typedef [element]. 1682 /// for typedef [element].
1655 /// 1683 ///
1656 /// For instance: 1684 /// For instance:
1657 /// typedef F(); 1685 /// typedef F();
1658 /// m(rhs) => F += rhs; 1686 /// m(rhs) => F += rhs;
1659 /// 1687 ///
1660 R visitTypedefTypeLiteralCompound( 1688 R errorTypedefTypeLiteralCompound(
1661 Send node, 1689 Send node,
1662 TypeConstantExpression constant, 1690 TypeConstantExpression constant,
1663 AssignmentOperator operator, 1691 AssignmentOperator operator,
1664 Node rhs, 1692 Node rhs,
1665 A arg); 1693 A arg);
1666 1694
1667 /// Compound assignment expression of [rhs] with [operator] on a type literal 1695 /// Compound assignment expression of [rhs] with [operator] on a type literal
1668 /// for type variable [element]. 1696 /// for type variable [element].
1669 /// 1697 ///
1670 /// For instance: 1698 /// For instance:
1671 /// class C<T> { 1699 /// class C<T> {
1672 /// m(rhs) => T += rhs; 1700 /// m(rhs) => T += rhs;
1673 /// } 1701 /// }
1674 /// 1702 ///
1675 R visitTypeVariableTypeLiteralCompound( 1703 R errorTypeVariableTypeLiteralCompound(
1676 Send node, 1704 Send node,
1677 TypeVariableElement element, 1705 TypeVariableElement element,
1678 AssignmentOperator operator, 1706 AssignmentOperator operator,
1679 Node rhs, 1707 Node rhs,
1680 A arg); 1708 A arg);
1681 1709
1682 /// Compound assignment expression of [rhs] with [operator] on the type 1710 /// Compound assignment expression of [rhs] with [operator] on the type
1683 /// literal for `dynamic`. 1711 /// literal for `dynamic`.
1684 /// 1712 ///
1685 /// For instance: 1713 /// For instance:
1686 /// m(rhs) => dynamic += rhs; 1714 /// m(rhs) => dynamic += rhs;
1687 /// 1715 ///
1688 R visitDynamicTypeLiteralCompound( 1716 R errorDynamicTypeLiteralCompound(
1689 Send node, 1717 Send node,
1690 TypeConstantExpression constant, 1718 TypeConstantExpression constant,
1691 AssignmentOperator operator, 1719 AssignmentOperator operator,
1692 Node rhs, 1720 Node rhs,
1693 A arg); 1721 A arg);
1694 1722
1695 /// Compound assignment expression of [rhs] with [operator] on the index 1723 /// Compound assignment expression of [rhs] with [operator] on the index
1696 /// operators of [receiver] whose getter and setter are defined by 1724 /// operators of [receiver] whose getter and setter are defined by
1697 /// [getterSelector] and [setterSelector], respectively. 1725 /// [getterSelector] and [setterSelector], respectively.
1698 /// 1726 ///
1699 /// For instance: 1727 /// For instance:
1700 /// m(receiver, index, rhs) => receiver[index] += rhs; 1728 /// m(receiver, index, rhs) => receiver[index] += rhs;
1701 /// 1729 ///
1702 R visitCompoundIndexSet( 1730 R visitCompoundIndexSet(
1703 Send node, 1731 SendSet node,
1704 Node receiver, 1732 Node receiver,
1705 Node index, 1733 Node index,
1706 AssignmentOperator operator, 1734 AssignmentOperator operator,
1707 Node rhs, 1735 Node rhs,
1708 A arg); 1736 A arg);
1709 1737
1710 /// Compound assignment expression of [rhs] with [operator] on the index 1738 /// Compound assignment expression of [rhs] with [operator] on the index
1711 /// operators of a super class defined by [getter] and [setter]. 1739 /// operators of a super class defined by [getter] and [setter].
1712 /// 1740 ///
1713 /// For instance: 1741 /// For instance:
1714 /// class B { 1742 /// class B {
1715 /// operator [](index) {} 1743 /// operator [](index) {}
1716 /// operator [](index, value) {} 1744 /// operator [](index, value) {}
1717 /// } 1745 /// }
1718 /// class C extends B { 1746 /// class C extends B {
1719 /// m(index, rhs) => super[index] += rhs; 1747 /// m(index, rhs) => super[index] += rhs;
1720 /// } 1748 /// }
1721 /// 1749 ///
1722 R visitSuperCompoundIndexSet( 1750 R visitSuperCompoundIndexSet(
1723 Send node, 1751 SendSet node,
1724 FunctionElement getter, 1752 FunctionElement getter,
1725 FunctionElement setter, 1753 FunctionElement setter,
1726 Node index, 1754 Node index,
1727 AssignmentOperator operator, 1755 AssignmentOperator operator,
1728 Node rhs, 1756 Node rhs,
1729 A arg); 1757 A arg);
1730 1758
1731 /// Prefix expression with [operator] of the property on [receiver] whose 1759 /// Prefix expression with [operator] of the property on [receiver] whose
1732 /// getter and setter are defined by [getterSelector] and [setterSelector], 1760 /// getter and setter are defined by [getterSelector] and [setterSelector],
1733 /// respectively. 1761 /// respectively.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 FunctionElement setter, 2039 FunctionElement setter,
2012 IncDecOperator operator, 2040 IncDecOperator operator,
2013 A arg); 2041 A arg);
2014 2042
2015 /// Prefix expression with [operator] on a type literal for a class [element]. 2043 /// Prefix expression with [operator] on a type literal for a class [element].
2016 /// 2044 ///
2017 /// For instance: 2045 /// For instance:
2018 /// class C {} 2046 /// class C {}
2019 /// m() => ++C; 2047 /// m() => ++C;
2020 /// 2048 ///
2021 R visitClassTypeLiteralPrefix( 2049 R errorClassTypeLiteralPrefix(
2022 Send node, 2050 Send node,
2023 TypeConstantExpression constant, 2051 TypeConstantExpression constant,
2024 IncDecOperator operator, 2052 IncDecOperator operator,
2025 A arg); 2053 A arg);
2026 2054
2027 /// Prefix expression with [operator] on a type literal for a typedef 2055 /// Prefix expression with [operator] on a type literal for a typedef
2028 /// [element]. 2056 /// [element].
2029 /// 2057 ///
2030 /// For instance: 2058 /// For instance:
2031 /// typedef F(); 2059 /// typedef F();
2032 /// m() => ++F; 2060 /// m() => ++F;
2033 /// 2061 ///
2034 R visitTypedefTypeLiteralPrefix( 2062 R errorTypedefTypeLiteralPrefix(
2035 Send node, 2063 Send node,
2036 TypeConstantExpression constant, 2064 TypeConstantExpression constant,
2037 IncDecOperator operator, 2065 IncDecOperator operator,
2038 A arg); 2066 A arg);
2039 2067
2040 /// Prefix expression with [operator] on a type literal for a type variable 2068 /// Prefix expression with [operator] on a type literal for a type variable
2041 /// [element]. 2069 /// [element].
2042 /// 2070 ///
2043 /// For instance: 2071 /// For instance:
2044 /// class C<T> { 2072 /// class C<T> {
2045 /// m() => ++T; 2073 /// m() => ++T;
2046 /// } 2074 /// }
2047 /// 2075 ///
2048 R visitTypeVariableTypeLiteralPrefix( 2076 R errorTypeVariableTypeLiteralPrefix(
2049 Send node, 2077 Send node,
2050 TypeVariableElement element, 2078 TypeVariableElement element,
2051 IncDecOperator operator, 2079 IncDecOperator operator,
2052 A arg); 2080 A arg);
2053 2081
2054 /// Prefix expression with [operator] on the type literal for `dynamic`. 2082 /// Prefix expression with [operator] on the type literal for `dynamic`.
2055 /// 2083 ///
2056 /// For instance: 2084 /// For instance:
2057 /// m() => ++dynamic; 2085 /// m() => ++dynamic;
2058 /// 2086 ///
2059 R visitDynamicTypeLiteralPrefix( 2087 R errorDynamicTypeLiteralPrefix(
2060 Send node, 2088 Send node,
2061 TypeConstantExpression constant, 2089 TypeConstantExpression constant,
2062 IncDecOperator operator, 2090 IncDecOperator operator,
2063 A arg); 2091 A arg);
2064 2092
2065 /// Postfix expression with [operator] of the property on [receiver] whose 2093 /// Postfix expression with [operator] of the property on [receiver] whose
2066 /// getter and setter are defined by [getterSelector] and [setterSelector], 2094 /// getter and setter are defined by [getterSelector] and [setterSelector],
2067 /// respectively. 2095 /// respectively.
2068 /// 2096 ///
2069 /// For instance: 2097 /// For instance:
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 IncDecOperator operator, 2374 IncDecOperator operator,
2347 A arg); 2375 A arg);
2348 2376
2349 /// Postfix expression with [operator] on a type literal for a class 2377 /// Postfix expression with [operator] on a type literal for a class
2350 /// [element]. 2378 /// [element].
2351 /// 2379 ///
2352 /// For instance: 2380 /// For instance:
2353 /// class C {} 2381 /// class C {}
2354 /// m() => C++; 2382 /// m() => C++;
2355 /// 2383 ///
2356 R visitClassTypeLiteralPostfix( 2384 R errorClassTypeLiteralPostfix(
2357 Send node, 2385 Send node,
2358 TypeConstantExpression constant, 2386 TypeConstantExpression constant,
2359 IncDecOperator operator, 2387 IncDecOperator operator,
2360 A arg); 2388 A arg);
2361 2389
2362 /// Postfix expression with [operator] on a type literal for a typedef 2390 /// Postfix expression with [operator] on a type literal for a typedef
2363 /// [element]. 2391 /// [element].
2364 /// 2392 ///
2365 /// For instance: 2393 /// For instance:
2366 /// typedef F(); 2394 /// typedef F();
2367 /// m() => F++; 2395 /// m() => F++;
2368 /// 2396 ///
2369 R visitTypedefTypeLiteralPostfix( 2397 R errorTypedefTypeLiteralPostfix(
2370 Send node, 2398 Send node,
2371 TypeConstantExpression constant, 2399 TypeConstantExpression constant,
2372 IncDecOperator operator, 2400 IncDecOperator operator,
2373 A arg); 2401 A arg);
2374 2402
2375 /// Postfix expression with [operator] on a type literal for a type variable 2403 /// Postfix expression with [operator] on a type literal for a type variable
2376 /// [element]. 2404 /// [element].
2377 /// 2405 ///
2378 /// For instance: 2406 /// For instance:
2379 /// class C<T> { 2407 /// class C<T> {
2380 /// m() => T++; 2408 /// m() => T++;
2381 /// } 2409 /// }
2382 /// 2410 ///
2383 R visitTypeVariableTypeLiteralPostfix( 2411 R errorTypeVariableTypeLiteralPostfix(
2384 Send node, 2412 Send node,
2385 TypeVariableElement element, 2413 TypeVariableElement element,
2386 IncDecOperator operator, 2414 IncDecOperator operator,
2387 A arg); 2415 A arg);
2388 2416
2389 /// Postfix expression with [operator] on the type literal for `dynamic`. 2417 /// Postfix expression with [operator] on the type literal for `dynamic`.
2390 /// 2418 ///
2391 /// For instance: 2419 /// For instance:
2392 /// m() => dynamic++; 2420 /// m() => dynamic++;
2393 /// 2421 ///
2394 R visitDynamicTypeLiteralPostfix( 2422 R errorDynamicTypeLiteralPostfix(
2395 Send node, 2423 Send node,
2396 TypeConstantExpression constant, 2424 TypeConstantExpression constant,
2397 IncDecOperator operator, 2425 IncDecOperator operator,
2398 A arg); 2426 A arg);
2399 2427
2400 /// Read of the [constant]. 2428 /// Read of the [constant].
2401 /// 2429 ///
2402 /// For instance 2430 /// For instance
2403 /// const c = c; 2431 /// const c = c;
2404 /// m() => c; 2432 /// m() => c;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 2638
2611 /// Invocation of an undefined unary [operator] with operands 2639 /// Invocation of an undefined unary [operator] with operands
2612 /// [left] and [right]. 2640 /// [left] and [right].
2613 R errorUndefinedBinaryExpression( 2641 R errorUndefinedBinaryExpression(
2614 Send node, 2642 Send node,
2615 Node left, 2643 Node left,
2616 Operator operator, 2644 Operator operator,
2617 Node right, 2645 Node right,
2618 A arg); 2646 A arg);
2619 } 2647 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698