Skip to content

Commit 0710768

Browse files
committed
Rust: Make more CFG nodes leaves
1 parent 26c69b8 commit 0710768

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
230230
}
231231
}
232232

233+
class ItemTree extends LeafTree, Item { }
234+
233235
// `LetExpr` is a pre-order tree such that the pattern itself ends up
234236
// dominating successors in the graph in the same way that patterns do in
235237
// `match` expressions.
@@ -472,18 +474,6 @@ class ParenExprTree extends StandardPostOrderTree, ParenExpr {
472474
// This covers all patterns as they all extend `Pat`
473475
class PatExprTree extends LeafTree instanceof Pat { }
474476

475-
class PathTree extends StandardPostOrderTree, Path {
476-
override AstNode getChildNode(int i) {
477-
i = 0 and result = this.getQualifier()
478-
or
479-
i = 1 and result = this.getPart()
480-
}
481-
}
482-
483-
class PathSegmentTree extends StandardPostOrderTree, PathSegment {
484-
override AstNode getChildNode(int i) { i = 0 and result = this.getNameRef() }
485-
}
486-
487477
class PathExprTree extends LeafTree instanceof PathExpr { }
488478

489479
class PrefixExprTree extends StandardPostOrderTree instanceof PrefixExpr {
@@ -522,14 +512,6 @@ class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
522512
}
523513
}
524514

525-
class StaticTree extends StandardPostOrderTree, Static {
526-
override AstNode getChildNode(int i) {
527-
i = 0 and result = this.getName()
528-
or
529-
i = 1 and result = this.getBody()
530-
}
531-
}
532-
533515
class TupleExprTree extends StandardPostOrderTree instanceof TupleExpr {
534516
override AstNode getChildNode(int i) { result = super.getField(i) }
535517
}
@@ -538,10 +520,6 @@ class TypeRefTree extends LeafTree instanceof TypeRef { }
538520

539521
class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
540522

541-
class UseTree_ extends StandardPreOrderTree, Use {
542-
override AstNode getChildNode(int i) { i = 0 and result = this.getUseTree().getPath() }
543-
}
544-
545523
// NOTE: `yield` is a reserved but unused keyword.
546524
class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
547525
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }

0 commit comments

Comments
 (0)