diff --git a/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll b/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll index cc4f3d06811..c9c7364e1cb 100644 --- a/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll +++ b/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll @@ -1203,15 +1203,11 @@ module Trees { private class SingletonMethodTree extends RescueEnsureBlockTree, SingletonMethod { final override AstNode getChildNode(int i, boolean rescuable) { - result = this.getObject() and + result = this.getParameters() and i = 0 and rescuable = false or - result = this.getParameters() and - i = 1 and - rescuable = false - or - result = this.getChild(i - 2) and + result = this.getChild(i - 1) and rescuable = true } diff --git a/ql/test/library-tests/controlflow/graph/Cfg.expected b/ql/test/library-tests/controlflow/graph/Cfg.expected index 88146edbf0c..204f8781111 100644 --- a/ql/test/library-tests/controlflow/graph/Cfg.expected +++ b/ql/test/library-tests/controlflow/graph/Cfg.expected @@ -50,7 +50,7 @@ cfg.rb: #-----| -> String # 149| enter method -#-----| -> silly +#-----| -> SplatParameter # 153| enter two_parameters #-----| -> a @@ -1543,9 +1543,6 @@ cfg.rb: # 148| new #-----| -> Call -# 149| silly -#-----| -> SplatParameter - # 149| SplatParameter #-----| -> x