diff --git a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll index 0aa93e573ebed..a6c8bfecaa966 100644 --- a/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll +++ b/ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImpl.qll @@ -76,12 +76,16 @@ abstract class CfgScopeImpl extends AstNode { } private class ToplevelScope extends CfgScopeImpl, Toplevel { + ToplevelScope() { exists(this.getAStmt()) } + final override predicate entry(AstNode first) { first(this, first) } final override predicate exit(AstNode last, Completion c) { last(this, last, c) } } private class EndBlockScope extends CfgScopeImpl, EndBlock { + EndBlockScope() { exists(this.getAStmt()) } + final override predicate entry(AstNode first) { first(this.(Trees::EndBlockTree).getBodyChild(0, _), first) } @@ -95,6 +99,8 @@ private class EndBlockScope extends CfgScopeImpl, EndBlock { } private class BodyStmtCallableScope extends CfgScopeImpl, AstInternal::TBodyStmt, Callable { + BodyStmtCallableScope() { exists(this.getAStmt()) } + final override predicate entry(AstNode first) { this.(Trees::BodyStmtTree).firstInner(first) } final override predicate exit(AstNode last, Completion c) { @@ -103,6 +109,8 @@ private class BodyStmtCallableScope extends CfgScopeImpl, AstInternal::TBodyStmt } private class BraceBlockScope extends CfgScopeImpl, BraceBlock { + BraceBlockScope() { exists(this.getAStmt()) } + final override predicate entry(AstNode first) { first(this.(Trees::BraceBlockTree).getBodyChild(0, _), first) }