|
| 1 | +private import swift |
| 2 | +private import Completion |
| 3 | +private import ControlFlowGraphImplShared |
| 4 | +private import ControlFlowElements |
| 5 | + |
| 6 | +abstract class AstControlFlowTree extends ControlFlowTree { |
| 7 | + AstNode ast; |
| 8 | + |
| 9 | + AstControlFlowTree() { ast = this.asAstNode() } |
| 10 | + |
| 11 | + AstNode getAst() { result = ast } |
| 12 | +} |
| 13 | + |
| 14 | +/** |
| 15 | + * Holds if `first` is the first element executed within control flow |
| 16 | + * element `cft`. |
| 17 | + */ |
| 18 | +predicate astFirst(AstNode cft, ControlFlowElement first) { |
| 19 | + first(any(ControlFlowTree tree | cft = tree.asAstNode()), first) |
| 20 | +} |
| 21 | + |
| 22 | +/** |
| 23 | + * Holds if `last` with completion `c` is a potential last element executed |
| 24 | + * within control flow element `cft`. |
| 25 | + */ |
| 26 | +predicate astLast(AstNode cft, ControlFlowElement last, Completion c) { |
| 27 | + last(any(ControlFlowTree tree | cft = tree.asAstNode()), last, c) |
| 28 | +} |
| 29 | + |
| 30 | +abstract class AstPreOrderTree extends AstControlFlowTree, PreOrderTree { } |
| 31 | + |
| 32 | +abstract class AstPostOrderTree extends AstControlFlowTree, PostOrderTree { } |
| 33 | + |
| 34 | +abstract class AstStandardTree extends AstControlFlowTree, StandardTree { } |
| 35 | + |
| 36 | +abstract class AstStandardPreOrderTree extends AstStandardTree, StandardPreOrderTree { } |
| 37 | + |
| 38 | +abstract class AstStandardPostOrderTree extends AstStandardTree, StandardPostOrderTree { } |
| 39 | + |
| 40 | +abstract class AstLeafTree extends AstPreOrderTree, AstPostOrderTree, LeafTree { } |
0 commit comments