Skip to content

Commit 3bbb166

Browse files
committed
Ruby: handle block param types more neatly
1 parent 52305da commit 3bbb166

File tree

1 file changed

+2
-5
lines changed
  • ruby/ql/lib/codeql/ruby/experimental

1 file changed

+2
-5
lines changed

ruby/ql/lib/codeql/ruby/experimental/Rbi.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ module Rbi {
311311
MethodSignatureCall getMethodSignatureCall() { result = sigCall }
312312
}
313313

314-
bindingset[paramName]
315-
private predicate isBlockParamName(string paramName) { paramName = ["blk", "block"] }
316-
317314
/**
318315
* A call to `params`. This defines the types of parameters to a method or proc.
319316
*/
@@ -328,7 +325,7 @@ module Rbi {
328325
// explicitly exclude keyword parameters
329326
not this.getAssociatedParameter(result.getName()) instanceof KeywordParameter and
330327
// and exclude block arguments
331-
not isBlockParamName(result.getName())
328+
not this.getAssociatedParameter(result.getName()) instanceof BlockParameter
332329
}
333330

334331
/** Gets the type of the keyword parameter named `keyword`. */
@@ -342,7 +339,7 @@ module Rbi {
342339

343340
/** Gets the type of the block parameter to the associated method. */
344341
ParameterType getBlockParameterType() {
345-
isBlockParamName(result.getName()) and
342+
this.getAssociatedParameter(result.getName()) instanceof BlockParameter and
346343
result = this.getArgument(_)
347344
}
348345

0 commit comments

Comments
 (0)