Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** | 5 /** |
| 6 * Defines AST visitors that support useful patterns for visiting the nodes in | 6 * Defines AST visitors that support useful patterns for visiting the nodes in |
| 7 * an [AST structure](ast.dart). | 7 * an [AST structure](ast.dart). |
| 8 * | 8 * |
| 9 * Dart is an evolving language, and the AST structure must evolved with it. | 9 * Dart is an evolving language, and the AST structure must evolved with it. |
| 10 * When the AST structure changes, the visitor interface will sometimes change | 10 * When the AST structure changes, the visitor interface will sometimes change |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 | 888 |
| 889 @override | 889 @override |
| 890 T visitYieldStatement(YieldStatement node) { | 890 T visitYieldStatement(YieldStatement node) { |
| 891 _delegates.forEach((delegate) => delegate.visitYieldStatement(node)); | 891 _delegates.forEach((delegate) => delegate.visitYieldStatement(node)); |
| 892 node.visitChildren(this); | 892 node.visitChildren(this); |
| 893 return null; | 893 return null; |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 | 896 |
| 897 /** | 897 /** |
| 898 * An AST Visitor that captures visit call timings. | |
| 899 */ | |
| 900 class TimedAstVisitor<T> implements AstVisitor<T> { | |
| 901 /** | |
| 902 * The base visitor whose visit methods will be timed. | |
| 903 */ | |
| 904 final AstVisitor<T> _baseVisitor; | |
| 905 | |
| 906 /** | |
| 907 * Collects elapsed time for visit calls. | |
| 908 */ | |
| 909 final Stopwatch stopwatch; | |
| 910 | |
| 911 /** | |
| 912 * Initialize a newly created visitor to time calls to the given base | |
| 913 * visitor's visits. | |
| 914 */ | |
| 915 TimedAstVisitor(this._baseVisitor, [Stopwatch watch]) | |
| 916 : stopwatch = watch != null ? watch : new Stopwatch(); | |
|
Brian Wilkerson
2016/03/15 22:57:24
or "watch ?? new Stopwatch()"
pquitslund
2016/03/15 23:09:17
Done.
| |
| 917 | |
| 918 @override | |
| 919 T visitAdjacentStrings(AdjacentStrings node) { | |
| 920 stopwatch.start(); | |
| 921 T result = _baseVisitor.visitAdjacentStrings(node); | |
| 922 stopwatch.stop(); | |
| 923 node.visitChildren(this); | |
|
Brian Wilkerson
2016/03/15 22:57:24
I don't think we want the calls to visitChildren.
pquitslund
2016/03/15 23:09:17
Ah, yes! Fixed.
| |
| 924 return result; | |
| 925 } | |
| 926 | |
| 927 @override | |
| 928 T visitAnnotation(Annotation node) { | |
| 929 stopwatch.start(); | |
| 930 T result = _baseVisitor.visitAnnotation(node); | |
| 931 stopwatch.stop(); | |
| 932 node.visitChildren(this); | |
| 933 return result; | |
| 934 } | |
| 935 | |
| 936 @override | |
| 937 T visitArgumentList(ArgumentList node) { | |
| 938 stopwatch.start(); | |
| 939 T result = _baseVisitor.visitArgumentList(node); | |
| 940 stopwatch.stop(); | |
| 941 node.visitChildren(this); | |
| 942 return result; | |
| 943 } | |
| 944 | |
| 945 @override | |
| 946 T visitAsExpression(AsExpression node) { | |
| 947 stopwatch.start(); | |
| 948 T result = _baseVisitor.visitAsExpression(node); | |
| 949 stopwatch.stop(); | |
| 950 node.visitChildren(this); | |
| 951 return result; | |
| 952 } | |
| 953 | |
| 954 @override | |
| 955 T visitAssertStatement(AssertStatement node) { | |
| 956 stopwatch.start(); | |
| 957 T result = _baseVisitor.visitAssertStatement(node); | |
| 958 stopwatch.stop(); | |
| 959 node.visitChildren(this); | |
| 960 return result; | |
| 961 } | |
| 962 | |
| 963 @override | |
| 964 T visitAssignmentExpression(AssignmentExpression node) { | |
| 965 stopwatch.start(); | |
| 966 T result = _baseVisitor.visitAssignmentExpression(node); | |
| 967 stopwatch.stop(); | |
| 968 node.visitChildren(this); | |
| 969 return result; | |
| 970 } | |
| 971 | |
| 972 @override | |
| 973 T visitAwaitExpression(AwaitExpression node) { | |
| 974 stopwatch.start(); | |
| 975 T result = _baseVisitor.visitAwaitExpression(node); | |
| 976 stopwatch.stop(); | |
| 977 node.visitChildren(this); | |
| 978 return result; | |
| 979 } | |
| 980 | |
| 981 @override | |
| 982 T visitBinaryExpression(BinaryExpression node) { | |
| 983 stopwatch.start(); | |
| 984 T result = _baseVisitor.visitBinaryExpression(node); | |
| 985 stopwatch.stop(); | |
| 986 node.visitChildren(this); | |
| 987 return result; | |
| 988 } | |
| 989 | |
| 990 @override | |
| 991 T visitBlock(Block node) { | |
| 992 stopwatch.start(); | |
| 993 T result = _baseVisitor.visitBlock(node); | |
| 994 stopwatch.stop(); | |
| 995 node.visitChildren(this); | |
| 996 return result; | |
| 997 } | |
| 998 | |
| 999 @override | |
| 1000 T visitBlockFunctionBody(BlockFunctionBody node) { | |
| 1001 stopwatch.start(); | |
| 1002 T result = _baseVisitor.visitBlockFunctionBody(node); | |
| 1003 stopwatch.stop(); | |
| 1004 node.visitChildren(this); | |
| 1005 return result; | |
| 1006 } | |
| 1007 | |
| 1008 @override | |
| 1009 T visitBooleanLiteral(BooleanLiteral node) { | |
| 1010 stopwatch.start(); | |
| 1011 T result = _baseVisitor.visitBooleanLiteral(node); | |
| 1012 stopwatch.stop(); | |
| 1013 node.visitChildren(this); | |
| 1014 return result; | |
| 1015 } | |
| 1016 | |
| 1017 @override | |
| 1018 T visitBreakStatement(BreakStatement node) { | |
| 1019 stopwatch.start(); | |
| 1020 T result = _baseVisitor.visitBreakStatement(node); | |
| 1021 stopwatch.stop(); | |
| 1022 node.visitChildren(this); | |
| 1023 return result; | |
| 1024 } | |
| 1025 | |
| 1026 @override | |
| 1027 T visitCascadeExpression(CascadeExpression node) { | |
| 1028 stopwatch.start(); | |
| 1029 T result = _baseVisitor.visitCascadeExpression(node); | |
| 1030 stopwatch.stop(); | |
| 1031 node.visitChildren(this); | |
| 1032 return result; | |
| 1033 } | |
| 1034 | |
| 1035 @override | |
| 1036 T visitCatchClause(CatchClause node) { | |
| 1037 stopwatch.start(); | |
| 1038 T result = _baseVisitor.visitCatchClause(node); | |
| 1039 stopwatch.stop(); | |
| 1040 node.visitChildren(this); | |
| 1041 return result; | |
| 1042 } | |
| 1043 | |
| 1044 @override | |
| 1045 T visitClassDeclaration(ClassDeclaration node) { | |
| 1046 stopwatch.start(); | |
| 1047 T result = _baseVisitor.visitClassDeclaration(node); | |
| 1048 stopwatch.stop(); | |
| 1049 node.visitChildren(this); | |
| 1050 return result; | |
| 1051 } | |
| 1052 | |
| 1053 @override | |
| 1054 T visitClassTypeAlias(ClassTypeAlias node) { | |
| 1055 stopwatch.start(); | |
| 1056 T result = _baseVisitor.visitClassTypeAlias(node); | |
| 1057 stopwatch.stop(); | |
| 1058 node.visitChildren(this); | |
| 1059 return result; | |
| 1060 } | |
| 1061 | |
| 1062 @override | |
| 1063 T visitComment(Comment node) { | |
| 1064 stopwatch.start(); | |
| 1065 T result = _baseVisitor.visitComment(node); | |
| 1066 stopwatch.stop(); | |
| 1067 node.visitChildren(this); | |
| 1068 return result; | |
| 1069 } | |
| 1070 | |
| 1071 @override | |
| 1072 T visitCommentReference(CommentReference node) { | |
| 1073 stopwatch.start(); | |
| 1074 T result = _baseVisitor.visitCommentReference(node); | |
| 1075 stopwatch.stop(); | |
| 1076 node.visitChildren(this); | |
| 1077 return result; | |
| 1078 } | |
| 1079 | |
| 1080 @override | |
| 1081 T visitCompilationUnit(CompilationUnit node) { | |
| 1082 stopwatch.start(); | |
| 1083 T result = _baseVisitor.visitCompilationUnit(node); | |
| 1084 stopwatch.stop(); | |
| 1085 node.visitChildren(this); | |
| 1086 return result; | |
| 1087 } | |
| 1088 | |
| 1089 @override | |
| 1090 T visitConditionalExpression(ConditionalExpression node) { | |
| 1091 stopwatch.start(); | |
| 1092 T result = _baseVisitor.visitConditionalExpression(node); | |
| 1093 stopwatch.stop(); | |
| 1094 node.visitChildren(this); | |
| 1095 return result; | |
| 1096 } | |
| 1097 | |
| 1098 @override | |
| 1099 T visitConfiguration(Configuration node) { | |
| 1100 stopwatch.start(); | |
| 1101 T result = _baseVisitor.visitConfiguration(node); | |
| 1102 stopwatch.stop(); | |
| 1103 node.visitChildren(this); | |
| 1104 return result; | |
| 1105 } | |
| 1106 | |
| 1107 @override | |
| 1108 T visitConstructorDeclaration(ConstructorDeclaration node) { | |
| 1109 stopwatch.start(); | |
| 1110 T result = _baseVisitor.visitConstructorDeclaration(node); | |
| 1111 stopwatch.stop(); | |
| 1112 node.visitChildren(this); | |
| 1113 return result; | |
| 1114 } | |
| 1115 | |
| 1116 @override | |
| 1117 T visitConstructorFieldInitializer(ConstructorFieldInitializer node) { | |
| 1118 stopwatch.start(); | |
| 1119 T result = _baseVisitor.visitConstructorFieldInitializer(node); | |
| 1120 stopwatch.stop(); | |
| 1121 node.visitChildren(this); | |
| 1122 return result; | |
| 1123 } | |
| 1124 | |
| 1125 @override | |
| 1126 T visitConstructorName(ConstructorName node) { | |
| 1127 stopwatch.start(); | |
| 1128 T result = _baseVisitor.visitConstructorName(node); | |
| 1129 stopwatch.stop(); | |
| 1130 node.visitChildren(this); | |
| 1131 return result; | |
| 1132 } | |
| 1133 | |
| 1134 @override | |
| 1135 T visitContinueStatement(ContinueStatement node) { | |
| 1136 stopwatch.start(); | |
| 1137 T result = _baseVisitor.visitContinueStatement(node); | |
| 1138 stopwatch.stop(); | |
| 1139 node.visitChildren(this); | |
| 1140 return result; | |
| 1141 } | |
| 1142 | |
| 1143 @override | |
| 1144 T visitDeclaredIdentifier(DeclaredIdentifier node) { | |
| 1145 stopwatch.start(); | |
| 1146 T result = _baseVisitor.visitDeclaredIdentifier(node); | |
| 1147 stopwatch.stop(); | |
| 1148 node.visitChildren(this); | |
| 1149 return result; | |
| 1150 } | |
| 1151 | |
| 1152 @override | |
| 1153 T visitDefaultFormalParameter(DefaultFormalParameter node) { | |
| 1154 stopwatch.start(); | |
| 1155 T result = _baseVisitor.visitDefaultFormalParameter(node); | |
| 1156 stopwatch.stop(); | |
| 1157 node.visitChildren(this); | |
| 1158 return result; | |
| 1159 } | |
| 1160 | |
| 1161 @override | |
| 1162 T visitDoStatement(DoStatement node) { | |
| 1163 stopwatch.start(); | |
| 1164 T result = _baseVisitor.visitDoStatement(node); | |
| 1165 stopwatch.stop(); | |
| 1166 node.visitChildren(this); | |
| 1167 return result; | |
| 1168 } | |
| 1169 | |
| 1170 @override | |
| 1171 T visitDottedName(DottedName node) { | |
| 1172 stopwatch.start(); | |
| 1173 T result = _baseVisitor.visitDottedName(node); | |
| 1174 stopwatch.stop(); | |
| 1175 node.visitChildren(this); | |
| 1176 return result; | |
| 1177 } | |
| 1178 | |
| 1179 @override | |
| 1180 T visitDoubleLiteral(DoubleLiteral node) { | |
| 1181 stopwatch.start(); | |
| 1182 T result = _baseVisitor.visitDoubleLiteral(node); | |
| 1183 stopwatch.stop(); | |
| 1184 node.visitChildren(this); | |
| 1185 return result; | |
| 1186 } | |
| 1187 | |
| 1188 @override | |
| 1189 T visitEmptyFunctionBody(EmptyFunctionBody node) { | |
| 1190 stopwatch.start(); | |
| 1191 T result = _baseVisitor.visitEmptyFunctionBody(node); | |
| 1192 stopwatch.stop(); | |
| 1193 node.visitChildren(this); | |
| 1194 return result; | |
| 1195 } | |
| 1196 | |
| 1197 @override | |
| 1198 T visitEmptyStatement(EmptyStatement node) { | |
| 1199 stopwatch.start(); | |
| 1200 T result = _baseVisitor.visitEmptyStatement(node); | |
| 1201 stopwatch.stop(); | |
| 1202 node.visitChildren(this); | |
| 1203 return result; | |
| 1204 } | |
| 1205 | |
| 1206 @override | |
| 1207 T visitEnumConstantDeclaration(EnumConstantDeclaration node) { | |
| 1208 stopwatch.start(); | |
| 1209 T result = _baseVisitor.visitEnumConstantDeclaration(node); | |
| 1210 stopwatch.stop(); | |
| 1211 node.visitChildren(this); | |
| 1212 return result; | |
| 1213 } | |
| 1214 | |
| 1215 @override | |
| 1216 T visitEnumDeclaration(EnumDeclaration node) { | |
| 1217 stopwatch.start(); | |
| 1218 T result = _baseVisitor.visitEnumDeclaration(node); | |
| 1219 stopwatch.stop(); | |
| 1220 node.visitChildren(this); | |
| 1221 return result; | |
| 1222 } | |
| 1223 | |
| 1224 @override | |
| 1225 T visitExportDirective(ExportDirective node) { | |
| 1226 stopwatch.start(); | |
| 1227 T result = _baseVisitor.visitExportDirective(node); | |
| 1228 stopwatch.stop(); | |
| 1229 node.visitChildren(this); | |
| 1230 return result; | |
| 1231 } | |
| 1232 | |
| 1233 @override | |
| 1234 T visitExpressionFunctionBody(ExpressionFunctionBody node) { | |
| 1235 stopwatch.start(); | |
| 1236 T result = _baseVisitor.visitExpressionFunctionBody(node); | |
| 1237 stopwatch.stop(); | |
| 1238 node.visitChildren(this); | |
| 1239 return result; | |
| 1240 } | |
| 1241 | |
| 1242 @override | |
| 1243 T visitExpressionStatement(ExpressionStatement node) { | |
| 1244 stopwatch.start(); | |
| 1245 T result = _baseVisitor.visitExpressionStatement(node); | |
| 1246 stopwatch.stop(); | |
| 1247 node.visitChildren(this); | |
| 1248 return result; | |
| 1249 } | |
| 1250 | |
| 1251 @override | |
| 1252 T visitExtendsClause(ExtendsClause node) { | |
| 1253 stopwatch.start(); | |
| 1254 T result = _baseVisitor.visitExtendsClause(node); | |
| 1255 stopwatch.stop(); | |
| 1256 node.visitChildren(this); | |
| 1257 return result; | |
| 1258 } | |
| 1259 | |
| 1260 @override | |
| 1261 T visitFieldDeclaration(FieldDeclaration node) { | |
| 1262 stopwatch.start(); | |
| 1263 T result = _baseVisitor.visitFieldDeclaration(node); | |
| 1264 stopwatch.stop(); | |
| 1265 node.visitChildren(this); | |
| 1266 return result; | |
| 1267 } | |
| 1268 | |
| 1269 @override | |
| 1270 T visitFieldFormalParameter(FieldFormalParameter node) { | |
| 1271 stopwatch.start(); | |
| 1272 T result = _baseVisitor.visitFieldFormalParameter(node); | |
| 1273 stopwatch.stop(); | |
| 1274 node.visitChildren(this); | |
| 1275 return result; | |
| 1276 } | |
| 1277 | |
| 1278 @override | |
| 1279 T visitForEachStatement(ForEachStatement node) { | |
| 1280 stopwatch.start(); | |
| 1281 T result = _baseVisitor.visitForEachStatement(node); | |
| 1282 stopwatch.stop(); | |
| 1283 node.visitChildren(this); | |
| 1284 return result; | |
| 1285 } | |
| 1286 | |
| 1287 @override | |
| 1288 T visitFormalParameterList(FormalParameterList node) { | |
| 1289 stopwatch.start(); | |
| 1290 T result = _baseVisitor.visitFormalParameterList(node); | |
| 1291 stopwatch.stop(); | |
| 1292 node.visitChildren(this); | |
| 1293 return result; | |
| 1294 } | |
| 1295 | |
| 1296 @override | |
| 1297 T visitForStatement(ForStatement node) { | |
| 1298 stopwatch.start(); | |
| 1299 T result = _baseVisitor.visitForStatement(node); | |
| 1300 stopwatch.stop(); | |
| 1301 node.visitChildren(this); | |
| 1302 return result; | |
| 1303 } | |
| 1304 | |
| 1305 @override | |
| 1306 T visitFunctionDeclaration(FunctionDeclaration node) { | |
| 1307 stopwatch.start(); | |
| 1308 T result = _baseVisitor.visitFunctionDeclaration(node); | |
| 1309 stopwatch.stop(); | |
| 1310 node.visitChildren(this); | |
| 1311 return result; | |
| 1312 } | |
| 1313 | |
| 1314 @override | |
| 1315 T visitFunctionDeclarationStatement(FunctionDeclarationStatement node) { | |
| 1316 stopwatch.start(); | |
| 1317 T result = _baseVisitor.visitFunctionDeclarationStatement(node); | |
| 1318 stopwatch.stop(); | |
| 1319 node.visitChildren(this); | |
| 1320 return result; | |
| 1321 } | |
| 1322 | |
| 1323 @override | |
| 1324 T visitFunctionExpression(FunctionExpression node) { | |
| 1325 stopwatch.start(); | |
| 1326 T result = _baseVisitor.visitFunctionExpression(node); | |
| 1327 stopwatch.stop(); | |
| 1328 node.visitChildren(this); | |
| 1329 return result; | |
| 1330 } | |
| 1331 | |
| 1332 @override | |
| 1333 T visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | |
| 1334 stopwatch.start(); | |
| 1335 T result = _baseVisitor.visitFunctionExpressionInvocation(node); | |
| 1336 stopwatch.stop(); | |
| 1337 node.visitChildren(this); | |
| 1338 return result; | |
| 1339 } | |
| 1340 | |
| 1341 @override | |
| 1342 T visitFunctionTypeAlias(FunctionTypeAlias node) { | |
| 1343 stopwatch.start(); | |
| 1344 T result = _baseVisitor.visitFunctionTypeAlias(node); | |
| 1345 stopwatch.stop(); | |
| 1346 node.visitChildren(this); | |
| 1347 return result; | |
| 1348 } | |
| 1349 | |
| 1350 @override | |
| 1351 T visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { | |
| 1352 stopwatch.start(); | |
| 1353 T result = _baseVisitor.visitFunctionTypedFormalParameter(node); | |
| 1354 stopwatch.stop(); | |
| 1355 node.visitChildren(this); | |
| 1356 return result; | |
| 1357 } | |
| 1358 | |
| 1359 @override | |
| 1360 T visitHideCombinator(HideCombinator node) { | |
| 1361 stopwatch.start(); | |
| 1362 T result = _baseVisitor.visitHideCombinator(node); | |
| 1363 stopwatch.stop(); | |
| 1364 node.visitChildren(this); | |
| 1365 return result; | |
| 1366 } | |
| 1367 | |
| 1368 @override | |
| 1369 T visitIfStatement(IfStatement node) { | |
| 1370 stopwatch.start(); | |
| 1371 T result = _baseVisitor.visitIfStatement(node); | |
| 1372 stopwatch.stop(); | |
| 1373 node.visitChildren(this); | |
| 1374 return result; | |
| 1375 } | |
| 1376 | |
| 1377 @override | |
| 1378 T visitImplementsClause(ImplementsClause node) { | |
| 1379 stopwatch.start(); | |
| 1380 T result = _baseVisitor.visitImplementsClause(node); | |
| 1381 stopwatch.stop(); | |
| 1382 node.visitChildren(this); | |
| 1383 return result; | |
| 1384 } | |
| 1385 | |
| 1386 @override | |
| 1387 T visitImportDirective(ImportDirective node) { | |
| 1388 stopwatch.start(); | |
| 1389 T result = _baseVisitor.visitImportDirective(node); | |
| 1390 stopwatch.stop(); | |
| 1391 node.visitChildren(this); | |
| 1392 return result; | |
| 1393 } | |
| 1394 | |
| 1395 @override | |
| 1396 T visitIndexExpression(IndexExpression node) { | |
| 1397 stopwatch.start(); | |
| 1398 T result = _baseVisitor.visitIndexExpression(node); | |
| 1399 stopwatch.stop(); | |
| 1400 node.visitChildren(this); | |
| 1401 return result; | |
| 1402 } | |
| 1403 | |
| 1404 @override | |
| 1405 T visitInstanceCreationExpression(InstanceCreationExpression node) { | |
| 1406 stopwatch.start(); | |
| 1407 T result = _baseVisitor.visitInstanceCreationExpression(node); | |
| 1408 stopwatch.stop(); | |
| 1409 node.visitChildren(this); | |
| 1410 return result; | |
| 1411 } | |
| 1412 | |
| 1413 @override | |
| 1414 T visitIntegerLiteral(IntegerLiteral node) { | |
| 1415 stopwatch.start(); | |
| 1416 T result = _baseVisitor.visitIntegerLiteral(node); | |
| 1417 stopwatch.stop(); | |
| 1418 node.visitChildren(this); | |
| 1419 return result; | |
| 1420 } | |
| 1421 | |
| 1422 @override | |
| 1423 T visitInterpolationExpression(InterpolationExpression node) { | |
| 1424 stopwatch.start(); | |
| 1425 T result = _baseVisitor.visitInterpolationExpression(node); | |
| 1426 stopwatch.stop(); | |
| 1427 node.visitChildren(this); | |
| 1428 return result; | |
| 1429 } | |
| 1430 | |
| 1431 @override | |
| 1432 T visitInterpolationString(InterpolationString node) { | |
| 1433 stopwatch.start(); | |
| 1434 T result = _baseVisitor.visitInterpolationString(node); | |
| 1435 stopwatch.stop(); | |
| 1436 node.visitChildren(this); | |
| 1437 return result; | |
| 1438 } | |
| 1439 | |
| 1440 @override | |
| 1441 T visitIsExpression(IsExpression node) { | |
| 1442 stopwatch.start(); | |
| 1443 T result = _baseVisitor.visitIsExpression(node); | |
| 1444 stopwatch.stop(); | |
| 1445 node.visitChildren(this); | |
| 1446 return result; | |
| 1447 } | |
| 1448 | |
| 1449 @override | |
| 1450 T visitLabel(Label node) { | |
| 1451 stopwatch.start(); | |
| 1452 T result = _baseVisitor.visitLabel(node); | |
| 1453 stopwatch.stop(); | |
| 1454 node.visitChildren(this); | |
| 1455 return result; | |
| 1456 } | |
| 1457 | |
| 1458 @override | |
| 1459 T visitLabeledStatement(LabeledStatement node) { | |
| 1460 stopwatch.start(); | |
| 1461 T result = _baseVisitor.visitLabeledStatement(node); | |
| 1462 stopwatch.stop(); | |
| 1463 node.visitChildren(this); | |
| 1464 return result; | |
| 1465 } | |
| 1466 | |
| 1467 @override | |
| 1468 T visitLibraryDirective(LibraryDirective node) { | |
| 1469 stopwatch.start(); | |
| 1470 T result = _baseVisitor.visitLibraryDirective(node); | |
| 1471 stopwatch.stop(); | |
| 1472 node.visitChildren(this); | |
| 1473 return result; | |
| 1474 } | |
| 1475 | |
| 1476 @override | |
| 1477 T visitLibraryIdentifier(LibraryIdentifier node) { | |
| 1478 stopwatch.start(); | |
| 1479 T result = _baseVisitor.visitLibraryIdentifier(node); | |
| 1480 stopwatch.stop(); | |
| 1481 node.visitChildren(this); | |
| 1482 return result; | |
| 1483 } | |
| 1484 | |
| 1485 @override | |
| 1486 T visitListLiteral(ListLiteral node) { | |
| 1487 stopwatch.start(); | |
| 1488 T result = _baseVisitor.visitListLiteral(node); | |
| 1489 stopwatch.stop(); | |
| 1490 node.visitChildren(this); | |
| 1491 return result; | |
| 1492 } | |
| 1493 | |
| 1494 @override | |
| 1495 T visitMapLiteral(MapLiteral node) { | |
| 1496 stopwatch.start(); | |
| 1497 T result = _baseVisitor.visitMapLiteral(node); | |
| 1498 stopwatch.stop(); | |
| 1499 node.visitChildren(this); | |
| 1500 return result; | |
| 1501 } | |
| 1502 | |
| 1503 @override | |
| 1504 T visitMapLiteralEntry(MapLiteralEntry node) { | |
| 1505 stopwatch.start(); | |
| 1506 T result = _baseVisitor.visitMapLiteralEntry(node); | |
| 1507 stopwatch.stop(); | |
| 1508 node.visitChildren(this); | |
| 1509 return result; | |
| 1510 } | |
| 1511 | |
| 1512 @override | |
| 1513 T visitMethodDeclaration(MethodDeclaration node) { | |
| 1514 stopwatch.start(); | |
| 1515 T result = _baseVisitor.visitMethodDeclaration(node); | |
| 1516 stopwatch.stop(); | |
| 1517 node.visitChildren(this); | |
| 1518 return result; | |
| 1519 } | |
| 1520 | |
| 1521 @override | |
| 1522 T visitMethodInvocation(MethodInvocation node) { | |
| 1523 stopwatch.start(); | |
| 1524 T result = _baseVisitor.visitMethodInvocation(node); | |
| 1525 stopwatch.stop(); | |
| 1526 node.visitChildren(this); | |
| 1527 return result; | |
| 1528 } | |
| 1529 | |
| 1530 @override | |
| 1531 T visitNamedExpression(NamedExpression node) { | |
| 1532 stopwatch.start(); | |
| 1533 T result = _baseVisitor.visitNamedExpression(node); | |
| 1534 stopwatch.stop(); | |
| 1535 node.visitChildren(this); | |
| 1536 return result; | |
| 1537 } | |
| 1538 | |
| 1539 @override | |
| 1540 T visitNativeClause(NativeClause node) { | |
| 1541 stopwatch.start(); | |
| 1542 T result = _baseVisitor.visitNativeClause(node); | |
| 1543 stopwatch.stop(); | |
| 1544 node.visitChildren(this); | |
| 1545 return result; | |
| 1546 } | |
| 1547 | |
| 1548 @override | |
| 1549 T visitNativeFunctionBody(NativeFunctionBody node) { | |
| 1550 stopwatch.start(); | |
| 1551 T result = _baseVisitor.visitNativeFunctionBody(node); | |
| 1552 stopwatch.stop(); | |
| 1553 node.visitChildren(this); | |
| 1554 return result; | |
| 1555 } | |
| 1556 | |
| 1557 @override | |
| 1558 T visitNullLiteral(NullLiteral node) { | |
| 1559 stopwatch.start(); | |
| 1560 T result = _baseVisitor.visitNullLiteral(node); | |
| 1561 stopwatch.stop(); | |
| 1562 node.visitChildren(this); | |
| 1563 return result; | |
| 1564 } | |
| 1565 | |
| 1566 @override | |
| 1567 T visitParenthesizedExpression(ParenthesizedExpression node) { | |
| 1568 stopwatch.start(); | |
| 1569 T result = _baseVisitor.visitParenthesizedExpression(node); | |
| 1570 stopwatch.stop(); | |
| 1571 node.visitChildren(this); | |
| 1572 return result; | |
| 1573 } | |
| 1574 | |
| 1575 @override | |
| 1576 T visitPartDirective(PartDirective node) { | |
| 1577 stopwatch.start(); | |
| 1578 T result = _baseVisitor.visitPartDirective(node); | |
| 1579 stopwatch.stop(); | |
| 1580 node.visitChildren(this); | |
| 1581 return result; | |
| 1582 } | |
| 1583 | |
| 1584 @override | |
| 1585 T visitPartOfDirective(PartOfDirective node) { | |
| 1586 stopwatch.start(); | |
| 1587 T result = _baseVisitor.visitPartOfDirective(node); | |
| 1588 stopwatch.stop(); | |
| 1589 node.visitChildren(this); | |
| 1590 return result; | |
| 1591 } | |
| 1592 | |
| 1593 @override | |
| 1594 T visitPostfixExpression(PostfixExpression node) { | |
| 1595 stopwatch.start(); | |
| 1596 T result = _baseVisitor.visitPostfixExpression(node); | |
| 1597 stopwatch.stop(); | |
| 1598 node.visitChildren(this); | |
| 1599 return result; | |
| 1600 } | |
| 1601 | |
| 1602 @override | |
| 1603 T visitPrefixedIdentifier(PrefixedIdentifier node) { | |
| 1604 stopwatch.start(); | |
| 1605 T result = _baseVisitor.visitPrefixedIdentifier(node); | |
| 1606 stopwatch.stop(); | |
| 1607 node.visitChildren(this); | |
| 1608 return result; | |
| 1609 } | |
| 1610 | |
| 1611 @override | |
| 1612 T visitPrefixExpression(PrefixExpression node) { | |
| 1613 stopwatch.start(); | |
| 1614 T result = _baseVisitor.visitPrefixExpression(node); | |
| 1615 stopwatch.stop(); | |
| 1616 node.visitChildren(this); | |
| 1617 return result; | |
| 1618 } | |
| 1619 | |
| 1620 @override | |
| 1621 T visitPropertyAccess(PropertyAccess node) { | |
| 1622 stopwatch.start(); | |
| 1623 T result = _baseVisitor.visitPropertyAccess(node); | |
| 1624 stopwatch.stop(); | |
| 1625 node.visitChildren(this); | |
| 1626 return result; | |
| 1627 } | |
| 1628 | |
| 1629 @override | |
| 1630 T visitRedirectingConstructorInvocation( | |
| 1631 RedirectingConstructorInvocation node) { | |
| 1632 stopwatch.start(); | |
| 1633 T result = _baseVisitor.visitRedirectingConstructorInvocation(node); | |
| 1634 stopwatch.stop(); | |
| 1635 node.visitChildren(this); | |
| 1636 return result; | |
| 1637 } | |
| 1638 | |
| 1639 @override | |
| 1640 T visitRethrowExpression(RethrowExpression node) { | |
| 1641 stopwatch.start(); | |
| 1642 T result = _baseVisitor.visitRethrowExpression(node); | |
| 1643 stopwatch.stop(); | |
| 1644 node.visitChildren(this); | |
| 1645 return result; | |
| 1646 } | |
| 1647 | |
| 1648 @override | |
| 1649 T visitReturnStatement(ReturnStatement node) { | |
| 1650 stopwatch.start(); | |
| 1651 T result = _baseVisitor.visitReturnStatement(node); | |
| 1652 stopwatch.stop(); | |
| 1653 node.visitChildren(this); | |
| 1654 return result; | |
| 1655 } | |
| 1656 | |
| 1657 @override | |
| 1658 T visitScriptTag(ScriptTag node) { | |
| 1659 stopwatch.start(); | |
| 1660 T result = _baseVisitor.visitScriptTag(node); | |
| 1661 stopwatch.stop(); | |
| 1662 node.visitChildren(this); | |
| 1663 return result; | |
| 1664 } | |
| 1665 | |
| 1666 @override | |
| 1667 T visitShowCombinator(ShowCombinator node) { | |
| 1668 stopwatch.start(); | |
| 1669 T result = _baseVisitor.visitShowCombinator(node); | |
| 1670 stopwatch.stop(); | |
| 1671 node.visitChildren(this); | |
| 1672 return result; | |
| 1673 } | |
| 1674 | |
| 1675 @override | |
| 1676 T visitSimpleFormalParameter(SimpleFormalParameter node) { | |
| 1677 stopwatch.start(); | |
| 1678 T result = _baseVisitor.visitSimpleFormalParameter(node); | |
| 1679 stopwatch.stop(); | |
| 1680 node.visitChildren(this); | |
| 1681 return result; | |
| 1682 } | |
| 1683 | |
| 1684 @override | |
| 1685 T visitSimpleIdentifier(SimpleIdentifier node) { | |
| 1686 stopwatch.start(); | |
| 1687 T result = _baseVisitor.visitSimpleIdentifier(node); | |
| 1688 stopwatch.stop(); | |
| 1689 node.visitChildren(this); | |
| 1690 return result; | |
| 1691 } | |
| 1692 | |
| 1693 @override | |
| 1694 T visitSimpleStringLiteral(SimpleStringLiteral node) { | |
| 1695 stopwatch.start(); | |
| 1696 T result = _baseVisitor.visitSimpleStringLiteral(node); | |
| 1697 stopwatch.stop(); | |
| 1698 node.visitChildren(this); | |
| 1699 return result; | |
| 1700 } | |
| 1701 | |
| 1702 @override | |
| 1703 T visitStringInterpolation(StringInterpolation node) { | |
| 1704 stopwatch.start(); | |
| 1705 T result = _baseVisitor.visitStringInterpolation(node); | |
| 1706 stopwatch.stop(); | |
| 1707 node.visitChildren(this); | |
| 1708 return result; | |
| 1709 } | |
| 1710 | |
| 1711 @override | |
| 1712 T visitSuperConstructorInvocation(SuperConstructorInvocation node) { | |
| 1713 stopwatch.start(); | |
| 1714 T result = _baseVisitor.visitSuperConstructorInvocation(node); | |
| 1715 stopwatch.stop(); | |
| 1716 node.visitChildren(this); | |
| 1717 return result; | |
| 1718 } | |
| 1719 | |
| 1720 @override | |
| 1721 T visitSuperExpression(SuperExpression node) { | |
| 1722 stopwatch.start(); | |
| 1723 T result = _baseVisitor.visitSuperExpression(node); | |
| 1724 stopwatch.stop(); | |
| 1725 node.visitChildren(this); | |
| 1726 return result; | |
| 1727 } | |
| 1728 | |
| 1729 @override | |
| 1730 T visitSwitchCase(SwitchCase node) { | |
| 1731 stopwatch.start(); | |
| 1732 T result = _baseVisitor.visitSwitchCase(node); | |
| 1733 stopwatch.stop(); | |
| 1734 node.visitChildren(this); | |
| 1735 return result; | |
| 1736 } | |
| 1737 | |
| 1738 @override | |
| 1739 T visitSwitchDefault(SwitchDefault node) { | |
| 1740 stopwatch.start(); | |
| 1741 T result = _baseVisitor.visitSwitchDefault(node); | |
| 1742 stopwatch.stop(); | |
| 1743 node.visitChildren(this); | |
| 1744 return result; | |
| 1745 } | |
| 1746 | |
| 1747 @override | |
| 1748 T visitSwitchStatement(SwitchStatement node) { | |
| 1749 stopwatch.start(); | |
| 1750 T result = _baseVisitor.visitSwitchStatement(node); | |
| 1751 stopwatch.stop(); | |
| 1752 node.visitChildren(this); | |
| 1753 return result; | |
| 1754 } | |
| 1755 | |
| 1756 @override | |
| 1757 T visitSymbolLiteral(SymbolLiteral node) { | |
| 1758 stopwatch.start(); | |
| 1759 T result = _baseVisitor.visitSymbolLiteral(node); | |
| 1760 stopwatch.stop(); | |
| 1761 node.visitChildren(this); | |
| 1762 return result; | |
| 1763 } | |
| 1764 | |
| 1765 @override | |
| 1766 T visitThisExpression(ThisExpression node) { | |
| 1767 stopwatch.start(); | |
| 1768 T result = _baseVisitor.visitThisExpression(node); | |
| 1769 stopwatch.stop(); | |
| 1770 node.visitChildren(this); | |
| 1771 return result; | |
| 1772 } | |
| 1773 | |
| 1774 @override | |
| 1775 T visitThrowExpression(ThrowExpression node) { | |
| 1776 stopwatch.start(); | |
| 1777 T result = _baseVisitor.visitThrowExpression(node); | |
| 1778 stopwatch.stop(); | |
| 1779 node.visitChildren(this); | |
| 1780 return result; | |
| 1781 } | |
| 1782 | |
| 1783 @override | |
| 1784 T visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { | |
| 1785 stopwatch.start(); | |
| 1786 T result = _baseVisitor.visitTopLevelVariableDeclaration(node); | |
| 1787 stopwatch.stop(); | |
| 1788 node.visitChildren(this); | |
| 1789 return result; | |
| 1790 } | |
| 1791 | |
| 1792 @override | |
| 1793 T visitTryStatement(TryStatement node) { | |
| 1794 stopwatch.start(); | |
| 1795 T result = _baseVisitor.visitTryStatement(node); | |
| 1796 stopwatch.stop(); | |
| 1797 node.visitChildren(this); | |
| 1798 return result; | |
| 1799 } | |
| 1800 | |
| 1801 @override | |
| 1802 T visitTypeArgumentList(TypeArgumentList node) { | |
| 1803 stopwatch.start(); | |
| 1804 T result = _baseVisitor.visitTypeArgumentList(node); | |
| 1805 stopwatch.stop(); | |
| 1806 node.visitChildren(this); | |
| 1807 return result; | |
| 1808 } | |
| 1809 | |
| 1810 @override | |
| 1811 T visitTypeName(TypeName node) { | |
| 1812 stopwatch.start(); | |
| 1813 T result = _baseVisitor.visitTypeName(node); | |
| 1814 stopwatch.stop(); | |
| 1815 node.visitChildren(this); | |
| 1816 return result; | |
| 1817 } | |
| 1818 | |
| 1819 @override | |
| 1820 T visitTypeParameter(TypeParameter node) { | |
| 1821 stopwatch.start(); | |
| 1822 T result = _baseVisitor.visitTypeParameter(node); | |
| 1823 stopwatch.stop(); | |
| 1824 node.visitChildren(this); | |
| 1825 return result; | |
| 1826 } | |
| 1827 | |
| 1828 @override | |
| 1829 T visitTypeParameterList(TypeParameterList node) { | |
| 1830 stopwatch.start(); | |
| 1831 T result = _baseVisitor.visitTypeParameterList(node); | |
| 1832 stopwatch.stop(); | |
| 1833 node.visitChildren(this); | |
| 1834 return result; | |
| 1835 } | |
| 1836 | |
| 1837 @override | |
| 1838 T visitVariableDeclaration(VariableDeclaration node) { | |
| 1839 stopwatch.start(); | |
| 1840 T result = _baseVisitor.visitVariableDeclaration(node); | |
| 1841 stopwatch.stop(); | |
| 1842 node.visitChildren(this); | |
| 1843 return result; | |
| 1844 } | |
| 1845 | |
| 1846 @override | |
| 1847 T visitVariableDeclarationList(VariableDeclarationList node) { | |
| 1848 stopwatch.start(); | |
| 1849 T result = _baseVisitor.visitVariableDeclarationList(node); | |
| 1850 stopwatch.stop(); | |
| 1851 node.visitChildren(this); | |
| 1852 return result; | |
| 1853 } | |
| 1854 | |
| 1855 @override | |
| 1856 T visitVariableDeclarationStatement(VariableDeclarationStatement node) { | |
| 1857 stopwatch.start(); | |
| 1858 T result = _baseVisitor.visitVariableDeclarationStatement(node); | |
| 1859 stopwatch.stop(); | |
| 1860 node.visitChildren(this); | |
| 1861 return result; | |
| 1862 } | |
| 1863 | |
| 1864 @override | |
| 1865 T visitWhileStatement(WhileStatement node) { | |
| 1866 stopwatch.start(); | |
| 1867 T result = _baseVisitor.visitWhileStatement(node); | |
| 1868 stopwatch.stop(); | |
| 1869 node.visitChildren(this); | |
| 1870 return result; | |
| 1871 } | |
| 1872 | |
| 1873 @override | |
| 1874 T visitWithClause(WithClause node) { | |
| 1875 stopwatch.start(); | |
| 1876 T result = _baseVisitor.visitWithClause(node); | |
| 1877 stopwatch.stop(); | |
| 1878 node.visitChildren(this); | |
| 1879 return result; | |
| 1880 } | |
| 1881 | |
| 1882 @override | |
| 1883 T visitYieldStatement(YieldStatement node) { | |
| 1884 stopwatch.start(); | |
| 1885 T result = _baseVisitor.visitYieldStatement(node); | |
| 1886 stopwatch.stop(); | |
| 1887 node.visitChildren(this); | |
| 1888 return result; | |
| 1889 } | |
| 1890 } | |
| 1891 | |
| 1892 /** | |
| 898 * An AST visitor that will recursively visit all of the nodes in an AST | 1893 * An AST visitor that will recursively visit all of the nodes in an AST |
| 899 * structure (like instances of the class [RecursiveAstVisitor]). In addition, | 1894 * structure (like instances of the class [RecursiveAstVisitor]). In addition, |
| 900 * when a node of a specific type is visited not only will the visit method for | 1895 * when a node of a specific type is visited not only will the visit method for |
| 901 * that specific type of node be invoked, but additional methods for the | 1896 * that specific type of node be invoked, but additional methods for the |
| 902 * superclasses of that node will also be invoked. For example, using an | 1897 * superclasses of that node will also be invoked. For example, using an |
| 903 * instance of this class to visit a [Block] will cause the method [visitBlock] | 1898 * instance of this class to visit a [Block] will cause the method [visitBlock] |
| 904 * to be invoked but will also cause the methods [visitStatement] and | 1899 * to be invoked but will also cause the methods [visitStatement] and |
| 905 * [visitNode] to be subsequently invoked. This allows visitors to be written | 1900 * [visitNode] to be subsequently invoked. This allows visitors to be written |
| 906 * that visit all statements without needing to override the visit method for | 1901 * that visit all statements without needing to override the visit method for |
| 907 * each of the specific subclasses of [Statement]. | 1902 * each of the specific subclasses of [Statement]. |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2697 * Initialize a newly created visitor to help the [outerVisitor]. | 3692 * Initialize a newly created visitor to help the [outerVisitor]. |
| 2698 */ | 3693 */ |
| 2699 _BreadthFirstChildVisitor(this.outerVisitor); | 3694 _BreadthFirstChildVisitor(this.outerVisitor); |
| 2700 | 3695 |
| 2701 @override | 3696 @override |
| 2702 Object visitNode(AstNode node) { | 3697 Object visitNode(AstNode node) { |
| 2703 outerVisitor._queue.add(node); | 3698 outerVisitor._queue.add(node); |
| 2704 return null; | 3699 return null; |
| 2705 } | 3700 } |
| 2706 } | 3701 } |
| OLD | NEW |