From ec4ead2117fbee3f88edfa17ac98b7ba0278754d Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Mon, 14 Dec 2020 14:53:35 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Arthur Baars --- .../internal/ControlFlowGraphImpl.qll | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll b/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll index 37658c3d64b..b37af98d2c6 100644 --- a/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll +++ b/ql/src/codeql_ruby/controlflow/internal/ControlFlowGraphImpl.qll @@ -377,12 +377,9 @@ module Trees { private class ClassTree extends RescueEnsureBlockTree, Class { final override AstNode getChildNode(int i, boolean rescuable) { - rescuable = true and - ( - result = this.getName() and i = 0 - or - result = this.getChild(i - 1) - ) + result = this.getName() and i = 0 and rescuable = false + or + result = this.getChild(i - 1) and rescuable = true } } @@ -824,12 +821,9 @@ module Trees { private class ModuleTree extends RescueEnsureBlockTree, Module { final override AstNode getChildNode(int i, boolean rescuable) { - rescuable = true and - ( - result = this.getName() and i = 0 - or - result = this.getChild(i - 1) - ) + result = this.getName() and i = 0 and rescuable = false + or + result = this.getChild(i - 1) and rescuable = true } } @@ -1229,7 +1223,7 @@ module Trees { final override AstNode getChildNode(int i, boolean rescuable) { result = this.getObject() and i = 0 and - rescuable = true // TODO: CHECK THIS + rescuable = false or result = this.getParameters() and i = 1 and