@@ -1078,40 +1078,50 @@ module StmtNodes {
1078
1078
StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1079
1079
}
1080
1080
1081
- class DoUntilStmtChildMapping extends NonExprChildMapping , DoUntilStmt {
1081
+ private class LoopStmtChildMapping extends NonExprChildMapping , LoopStmt {
1082
+ override predicate relevantChild ( Ast child ) { child = this .getBody ( ) }
1083
+ }
1084
+
1085
+ class LoopStmtCfgNode extends StmtCfgNode {
1086
+ override string getAPrimaryQlClass ( ) { result = "LoopStmtCfgNode" }
1087
+
1088
+ override LoopStmtChildMapping s ;
1089
+
1090
+ override LoopStmt getStmt ( ) { result = s }
1091
+
1092
+ StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1093
+ }
1094
+
1095
+ private class DoUntilStmtChildMapping extends LoopStmtChildMapping , DoUntilStmt {
1082
1096
override predicate relevantChild ( Ast child ) {
1083
- child = this .getCondition ( ) or child = this . getBody ( )
1097
+ child = this .getCondition ( ) or super . relevantChild ( child )
1084
1098
}
1085
1099
}
1086
1100
1087
- class DoUntilStmtCfgNode extends StmtCfgNode {
1101
+ class DoUntilStmtCfgNode extends LoopStmtCfgNode {
1088
1102
override string getAPrimaryQlClass ( ) { result = "DoUntilStmtCfgNode" }
1089
1103
1090
1104
override DoUntilStmtChildMapping s ;
1091
1105
1092
1106
override DoUntilStmt getStmt ( ) { result = s }
1093
1107
1094
1108
ExprCfgNode getCondition ( ) { s .hasCfgChild ( s .getCondition ( ) , this , result ) }
1095
-
1096
- StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1097
1109
}
1098
1110
1099
- private class DoWhileStmtChildMapping extends NonExprChildMapping , DoWhileStmt {
1111
+ private class DoWhileStmtChildMapping extends LoopStmtChildMapping , DoWhileStmt {
1100
1112
override predicate relevantChild ( Ast child ) {
1101
- child = this .getCondition ( ) or child = this . getBody ( )
1113
+ child = this .getCondition ( ) or super . relevantChild ( child )
1102
1114
}
1103
1115
}
1104
1116
1105
- class DoWhileStmtCfgNode extends StmtCfgNode {
1117
+ class DoWhileStmtCfgNode extends LoopStmtCfgNode {
1106
1118
override string getAPrimaryQlClass ( ) { result = "DoWhileStmtCfgNode" }
1107
1119
1108
1120
override DoWhileStmtChildMapping s ;
1109
1121
1110
1122
override DoWhileStmt getStmt ( ) { result = s }
1111
1123
1112
1124
ExprCfgNode getCondition ( ) { s .hasCfgChild ( s .getCondition ( ) , this , result ) }
1113
-
1114
- StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1115
1125
}
1116
1126
1117
1127
private class ErrorStmtChildMapping extends NonExprChildMapping , ErrorStmt {
@@ -1160,13 +1170,13 @@ module StmtNodes {
1160
1170
ExprCfgNode getHashTableExpr ( ) { s .hasCfgChild ( s .getHashTableExpr ( ) , this , result ) }
1161
1171
}
1162
1172
1163
- private class ForEachStmtChildMapping extends NonExprChildMapping , ForEachStmt {
1173
+ private class ForEachStmtChildMapping extends LoopStmtChildMapping , ForEachStmt {
1164
1174
override predicate relevantChild ( Ast child ) {
1165
- child = this .getVarAccess ( ) or child = this .getIterableExpr ( ) or child = this . getBody ( )
1175
+ child = this .getVarAccess ( ) or child = this .getIterableExpr ( ) or super . relevantChild ( child )
1166
1176
}
1167
1177
}
1168
1178
1169
- class ForEachStmtCfgNode extends StmtCfgNode {
1179
+ class ForEachStmtCfgNode extends LoopStmtCfgNode {
1170
1180
override string getAPrimaryQlClass ( ) { result = "ForEachStmtCfgNode" }
1171
1181
1172
1182
override ForEachStmtChildMapping s ;
@@ -1176,20 +1186,18 @@ module StmtNodes {
1176
1186
ExprCfgNode getVarAccess ( ) { s .hasCfgChild ( s .getVarAccess ( ) , this , result ) }
1177
1187
1178
1188
ExprCfgNode getIterableExpr ( ) { s .hasCfgChild ( s .getIterableExpr ( ) , this , result ) }
1179
-
1180
- StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1181
1189
}
1182
1190
1183
- private class ForStmtChildMapping extends NonExprChildMapping , ForStmt {
1191
+ private class ForStmtChildMapping extends LoopStmtChildMapping , ForStmt {
1184
1192
override predicate relevantChild ( Ast child ) {
1185
1193
child = this .getInitializer ( ) or
1186
1194
child = this .getCondition ( ) or
1187
1195
child = this .getIterator ( ) or
1188
- child = this . getBody ( )
1196
+ super . relevantChild ( child )
1189
1197
}
1190
1198
}
1191
1199
1192
- class ForStmtCfgNode extends StmtCfgNode {
1200
+ class ForStmtCfgNode extends LoopStmtCfgNode {
1193
1201
override string getAPrimaryQlClass ( ) { result = "ForStmtCfgNode" }
1194
1202
1195
1203
override ForStmtChildMapping s ;
@@ -1201,8 +1209,6 @@ module StmtNodes {
1201
1209
ExprCfgNode getCondition ( ) { s .hasCfgChild ( s .getCondition ( ) , this , result ) }
1202
1210
1203
1211
AstCfgNode getIterator ( ) { s .hasCfgChild ( s .getIterator ( ) , this , result ) }
1204
-
1205
- StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1206
1212
}
1207
1213
1208
1214
private class GotoStmtChildMapping extends NonExprChildMapping , GotoStmt {
@@ -1340,23 +1346,21 @@ module StmtNodes {
1340
1346
override UsingStmt getStmt ( ) { result = s }
1341
1347
}
1342
1348
1343
- private class WhileStmtChildMapping extends NonExprChildMapping , WhileStmt {
1349
+ private class WhileStmtChildMapping extends LoopStmtChildMapping , WhileStmt {
1344
1350
override predicate relevantChild ( Ast child ) {
1345
1351
child = this .getCondition ( ) or
1346
- child = this . getBody ( )
1352
+ super . relevantChild ( child )
1347
1353
}
1348
1354
}
1349
1355
1350
- class WhileStmtCfgNode extends StmtCfgNode {
1356
+ class WhileStmtCfgNode extends LoopStmtCfgNode {
1351
1357
override string getAPrimaryQlClass ( ) { result = "WhileStmtCfgNode" }
1352
1358
1353
1359
override WhileStmtChildMapping s ;
1354
1360
1355
1361
override WhileStmt getStmt ( ) { result = s }
1356
1362
1357
1363
ExprCfgNode getCondition ( ) { s .hasCfgChild ( s .getCondition ( ) , this , result ) }
1358
-
1359
- StmtCfgNode getBody ( ) { s .hasCfgChild ( s .getBody ( ) , this , result ) }
1360
1364
}
1361
1365
1362
1366
private class ConfigurationChildMapping extends NonExprChildMapping , Configuration {
0 commit comments