@@ -261,40 +261,52 @@ module MakeWithSplitting<
261261 /** Gets the `i`th child element, in order of evaluation. */
262262 abstract AstNode getChildNode ( int i ) ;
263263
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 )
266267 }
267268
268269 /** 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+ }
270282
271283 /** Gets the last child node of this node. */
272- final AstNode getLastChildElement ( ) {
284+ final ControlFlowTree getLastChildTree ( ) {
273285 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 ) )
276288 )
277289 }
278290
279291 /** Holds if this element has no children. */
280- predicate isLeafElement ( ) { not exists ( this .getFirstChildNode ( ) ) }
292+ predicate isLeafElement ( ) { not exists ( this .getFirstChildTree ( ) ) }
281293
282294 override predicate propagatesAbnormal ( AstNode child ) { child = this .getChildNode ( _) }
283295
284296 pragma [ nomagic]
285297 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
286298 exists ( int i |
287- last ( this .getChildNodeRanked ( i ) , pred , c ) and
299+ last ( this .getChildTreeRanked ( i ) , pred , c ) and
288300 completionIsNormal ( c ) and
289- first ( this .getChildNodeRanked ( i + 1 ) , succ )
301+ first ( this .getChildTreeRanked ( i + 1 ) , succ )
290302 )
291303 }
292304 }
293305
294306 /** A standard element that is executed in pre-order. */
295307 abstract class StandardPreOrderTree extends StandardTree , PreOrderTree {
296308 override predicate last ( AstNode last , Completion c ) {
297- last ( this .getLastChildElement ( ) , last , c )
309+ last ( this .getLastChildTree ( ) , last , c )
298310 or
299311 this .isLeafElement ( ) and
300312 completionIsValidFor ( c , this ) and
@@ -305,24 +317,24 @@ module MakeWithSplitting<
305317 StandardTree .super .succ ( pred , succ , c )
306318 or
307319 pred = this and
308- first ( this .getFirstChildNode ( ) , succ ) and
320+ first ( this .getFirstChildTree ( ) , succ ) and
309321 completionIsSimple ( c )
310322 }
311323 }
312324
313325 /** A standard element that is executed in post-order. */
314326 abstract class StandardPostOrderTree extends StandardTree , PostOrderTree {
315327 override predicate first ( AstNode first ) {
316- first ( this .getFirstChildNode ( ) , first )
328+ first ( this .getFirstChildTree ( ) , first )
317329 or
318- not exists ( this .getFirstChildNode ( ) ) and
330+ not exists ( this .getFirstChildTree ( ) ) and
319331 first = this
320332 }
321333
322334 override predicate succ ( AstNode pred , AstNode succ , Completion c ) {
323335 StandardTree .super .succ ( pred , succ , c )
324336 or
325- last ( this .getLastChildElement ( ) , pred , c ) and
337+ last ( this .getLastChildTree ( ) , pred , c ) and
326338 succ = this and
327339 completionIsNormal ( c )
328340 }
0 commit comments