Skip to content

Commit ff4ce4a

Browse files
committed
Ruby: use Element[n..] tokens in inject and reduce
1 parent fd9c1e4 commit ff4ce4a

File tree

1 file changed

+2
-2
lines changed
  • ruby/ql/lib/codeql/ruby/frameworks/core

1 file changed

+2
-2
lines changed

ruby/ql/lib/codeql/ruby/frameworks/core/Array.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,7 +2203,7 @@ module Enumerable {
22032203
input = "Argument[self].Element[0]" and
22042204
output = "Argument[block].Parameter[0]"
22052205
or
2206-
exists(ArrayIndex i | i > 0 | input = "Argument[self].Element[" + i + "]") and
2206+
input = "Argument[self].Element[1..]" and
22072207
output = "Argument[block].Parameter[1]"
22082208
or
22092209
input = "Argument[block].ReturnValue" and output = "ReturnValue"
@@ -2222,7 +2222,7 @@ module Enumerable {
22222222
output = "Argument[block].Parameter[0]"
22232223
or
22242224
// Each element in the receiver is passed to the second block parameter.
2225-
exists(ArrayIndex i | input = "Argument[self].Element[" + i + "]") and
2225+
input = "Argument[self].Element[0..]" and
22262226
output = "Argument[block].Parameter[1]"
22272227
or
22282228
input = "Argument[block].ReturnValue" and output = "ReturnValue"

0 commit comments

Comments
 (0)