From 9afda342bcc54cef63ab60c5333e90ec9cf5354d Mon Sep 17 00:00:00 2001 From: Arthur Baars Date: Wed, 14 Apr 2021 09:57:49 +0200 Subject: [PATCH] Address comments --- ql/src/codeql_ruby/ast/internal/Module.qll | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ql/src/codeql_ruby/ast/internal/Module.qll b/ql/src/codeql_ruby/ast/internal/Module.qll index 86d10b23c61..2d2c904b0d6 100644 --- a/ql/src/codeql_ruby/ast/internal/Module.qll +++ b/ql/src/codeql_ruby/ast/internal/Module.qll @@ -188,14 +188,12 @@ private class IncludeOrPrependCall extends MethodCall { * methods evaluate the block in the context of some other module/class instead of * the enclosing one. */ -private ModuleBase enclosingModule(AstNode node) { - exists(AstNode parent | parent = node.getParent() | - result = parent - or - not parent instanceof ModuleBase and - not parent instanceof Block and - result = enclosingModule(parent) - ) +private ModuleBase enclosingModule(AstNode node) { result = parent*(node).getParent() } + +private AstNode parent(AstNode n) { + result = n.getParent() and + not result instanceof ModuleBase and + not result instanceof Block } private string prepends(string qname) {