Skip to content

Commit

Permalink
Rust: DO NOT MERGE: patch cfg implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
aibaars committed Sep 18, 2024
1 parent 8bc28e0 commit acd812b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ class FunctionTree extends StandardPostOrderTree instanceof Function {

class BlockExprTree extends StandardPostOrderTree instanceof BlockExpr {
override ControlFlowTree getChildNode(int i) {
result = super.getStatement(i)
result = super.getStmtList().getStatement(i)
or
not exists(super.getStatement(i)) and
(exists(super.getStatement(i - 1)) or i = 0) and
result = super.getTail()
not exists(super.getStmtList().getStatement(i)) and
(exists(super.getStmtList().getStatement(i - 1)) or i = 0) and
result = super.getStmtList().getTailExpr()
}
}

class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
override ControlFlowTree getChildNode(int i) { result = super.getArg(i) }
override ControlFlowTree getChildNode(int i) { result = super.getArgList().getArg(i) }
}

class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
Expand Down Expand Up @@ -124,6 +124,3 @@ class LetExprTree extends StandardPostOrderTree instanceof LetExpr {
class LiteralExprTree extends LeafTree instanceof LiteralExpr { }

class PathExprTree extends LeafTree instanceof PathExpr { }

// A leaf tree for unimplemented nodes in the AST.
class UnimplementedTree extends LeafTree instanceof Unimplemented { }
2 changes: 1 addition & 1 deletion rust/ql/lib/codeql/rust/elements/internal/FunctionImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ module Impl {
* ```
*/
class Function extends Generated::Function {
override string toString() { result = this.getName() }
override string toString() { result = this.getName().toString() }
}
}

0 comments on commit acd812b

Please sign in to comment.