@@ -261,40 +261,52 @@ module MakeWithSplitting<
261
261
/** Gets the `i`th child element, in order of evaluation. */
262
262
abstract AstNode getChildNode ( int i ) ;
263
263
264
- private AstNode getChildNodeRanked ( int i ) {
265
- result = rank [ i + 1 ] ( AstNode child , int j | child = this .getChildNode ( j ) | child order by j )
264
+ private ControlFlowTree getChildTreeRanked ( int i ) {
265
+ result =
266
+ rank [ i + 1 ] ( ControlFlowTree child , int j | child = this .getChildNode ( j ) | child order by j )
266
267
}
267
268
268
269
/** Gets the first child node of this element. */
269
- final AstNode getFirstChildNode ( ) { result = this .getChildNodeRanked ( 0 ) }
270
+ deprecated final AstNode getFirstChildNode ( ) { result = this .getChildTreeRanked ( 0 ) }
271
+
272
+ /** Gets the first child node of this element. */
273
+ final ControlFlowTree getFirstChildTree ( ) { result = this .getChildTreeRanked ( 0 ) }
274
+
275
+ /** Gets the last child node of this node. */
276
+ deprecated final AstNode getLastChildElement ( ) {
277
+ exists ( int last |
278
+ result = this .getChildTreeRanked ( last ) and
279
+ not exists ( this .getChildTreeRanked ( last + 1 ) )
280
+ )
281
+ }
270
282
271
283
/** Gets the last child node of this node. */
272
- final AstNode getLastChildElement ( ) {
284
+ final ControlFlowTree getLastChildTree ( ) {
273
285
exists ( int last |
274
- result = this .getChildNodeRanked ( last ) and
275
- not exists ( this .getChildNodeRanked ( last + 1 ) )
286
+ result = this .getChildTreeRanked ( last ) and
287
+ not exists ( this .getChildTreeRanked ( last + 1 ) )
276
288
)
277
289
}
278
290
279
291
/** Holds if this element has no children. */
280
- predicate isLeafElement ( ) { not exists ( this .getFirstChildNode ( ) ) }
292
+ predicate isLeafElement ( ) { not exists ( this .getFirstChildTree ( ) ) }
281
293
282
294
override predicate propagatesAbnormal ( AstNode child ) { child = this .getChildNode ( _) }
283
295
284
296
pragma [ nomagic]
285
297
override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
286
298
exists ( int i |
287
- last ( this .getChildNodeRanked ( i ) , pred , c ) and
299
+ last ( this .getChildTreeRanked ( i ) , pred , c ) and
288
300
completionIsNormal ( c ) and
289
- first ( this .getChildNodeRanked ( i + 1 ) , succ )
301
+ first ( this .getChildTreeRanked ( i + 1 ) , succ )
290
302
)
291
303
}
292
304
}
293
305
294
306
/** A standard element that is executed in pre-order. */
295
307
abstract class StandardPreOrderTree extends StandardTree , PreOrderTree {
296
308
override predicate last ( AstNode last , Completion c ) {
297
- last ( this .getLastChildElement ( ) , last , c )
309
+ last ( this .getLastChildTree ( ) , last , c )
298
310
or
299
311
this .isLeafElement ( ) and
300
312
completionIsValidFor ( c , this ) and
@@ -305,24 +317,24 @@ module MakeWithSplitting<
305
317
StandardTree .super .succ ( pred , succ , c )
306
318
or
307
319
pred = this and
308
- first ( this .getFirstChildNode ( ) , succ ) and
320
+ first ( this .getFirstChildTree ( ) , succ ) and
309
321
completionIsSimple ( c )
310
322
}
311
323
}
312
324
313
325
/** A standard element that is executed in post-order. */
314
326
abstract class StandardPostOrderTree extends StandardTree , PostOrderTree {
315
327
override predicate first ( AstNode first ) {
316
- first ( this .getFirstChildNode ( ) , first )
328
+ first ( this .getFirstChildTree ( ) , first )
317
329
or
318
- not exists ( this .getFirstChildNode ( ) ) and
330
+ not exists ( this .getFirstChildTree ( ) ) and
319
331
first = this
320
332
}
321
333
322
334
override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
323
335
StandardTree .super .succ ( pred , succ , c )
324
336
or
325
- last ( this .getLastChildElement ( ) , pred , c ) and
337
+ last ( this .getLastChildTree ( ) , pred , c ) and
326
338
succ = this and
327
339
completionIsNormal ( c )
328
340
}
0 commit comments