Skip to content

Commit d9704d7

Browse files
committed
Ruby: Adapt to shared CFG changes
1 parent 42f6dfc commit d9704d7

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

ruby/ql/lib/codeql/ruby/controlflow/BasicBlocks.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private import SuccessorTypes
1515
*/
1616
class BasicBlock extends TBasicBlockStart {
1717
/** Gets the scope of this basic block. */
18-
CfgScope getScope() { result = this.getAPredecessor().getScope() }
18+
final CfgScope getScope() { result = this.getFirstNode().getScope() }
1919

2020
/** Gets an immediate successor of this basic block, if any. */
2121
BasicBlock getASuccessor() { result = this.getASuccessor(_) }
@@ -322,8 +322,6 @@ private predicate entryBB(BasicBlock bb) { bb.getFirstNode() instanceof EntryNod
322322
*/
323323
class EntryBasicBlock extends BasicBlock {
324324
EntryBasicBlock() { entryBB(this) }
325-
326-
override CfgScope getScope() { this.getFirstNode() = TEntryNode(result) }
327325
}
328326

329327
/**

ruby/ql/lib/codeql/ruby/controlflow/CfgNodes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class AstCfgNode extends CfgNode, TElementNode {
6767
private Splits splits;
6868
private AstNode n;
6969

70-
AstCfgNode() { this = TElementNode(n, splits) }
70+
AstCfgNode() { this = TElementNode(_, n, splits) }
7171

7272
final override AstNode getNode() { result = n }
7373

ruby/ql/lib/codeql/ruby/controlflow/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CfgNode extends TCfgNode {
4444
final predicate isCondition() { exists(this.getASuccessor(any(BooleanSuccessor bs))) }
4545

4646
/** Gets the scope of this node. */
47-
final CfgScope getScope() { result = this.getBasicBlock().getScope() }
47+
final CfgScope getScope() { result = getNodeCfgScope(this) }
4848

4949
/** Gets the basic block that this control flow node belongs to. */
5050
BasicBlock getBasicBlock() { result.getANode() = this }

0 commit comments

Comments
 (0)