Ruby: Test local data flow

This commit is contained in:
Calum Grant
2021-03-09 10:25:24 +00:00
parent 5b4bf584a1
commit 855d190800
3 changed files with 23 additions and 4 deletions

View File

@@ -4,3 +4,4 @@
| UseDetect.rb:8:9:8:34 | ...[...] | Replace this call and $@ with 'reverse_detect'. | UseDetect.rb:8:9:8:30 | call to select | 'select' call |
| UseDetect.rb:9:9:9:36 | call to first | Replace this call and $@ with 'detect'. | UseDetect.rb:9:9:9:30 | call to filter | 'select' call |
| UseDetect.rb:10:9:10:37 | call to last | Replace this call and $@ with 'reverse_detect'. | UseDetect.rb:10:9:10:32 | call to find_all | 'select' call |
| UseDetect.rb:12:9:12:24 | call to first | Replace this call and $@ with 'detect'. | UseDetect.rb:11:22:11:43 | call to select | 'select' call |

View File

@@ -8,9 +8,14 @@ class DetectTest
[].select { |i| true }[-1]
[].filter { |i| true }.first
[].find_all { |i| true }.last
selection1 = [].select { |i| true }
selection1.first
# These are good
[].select("").first
[].select { |i| true }[1]
[].select("").first # Selecting a string
[].select { |i| true }[1] # Selecting the second element
selection2 = [].select { |i| true }
selection2.first # Selection used elsewhere
selection3 = selection2
end
end