File tree Expand file tree Collapse file tree 2 files changed +11
-16
lines changed
spec/tags/core/enumerator/lazy
src/main/ruby/truffleruby/core Expand file tree Collapse file tree 2 files changed +11
-16
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -408,20 +408,18 @@ def grep(pattern, &block)
408
408
end
409
409
end
410
410
411
- def grep_v ( pattern )
412
- if block_given?
413
- Lazy . new ( self , nil ) do |yielder , *args |
414
- val = args . length >= 2 ? args : args . first
415
- unless pattern === val
416
- # Regexp.set_block_last_match # TODO BJF Aug 2, 2016 Investigate for removal
411
+ def grep_v ( pattern , &block )
412
+ binding = block ? block . binding : Truffle . invoke_primitive ( :caller_binding )
413
+
414
+ Lazy . new ( self , nil ) do |yielder , *args |
415
+ val = args . length >= 2 ? args : args . first
416
+ matches = pattern === val
417
+ Truffle ::RegexpOperations . set_last_match ( $~, binding )
418
+
419
+ unless matches
420
+ if block
417
421
yielder . yield yield ( val )
418
- end
419
- end
420
- else
421
- Lazy . new ( self , nil ) do |yielder , *args |
422
- val = args . length >= 2 ? args : args . first
423
- unless pattern === val
424
- # Regexp.set_block_last_match # TODO BJF Aug 2, 2016 Investigate for removal
422
+ else
425
423
yielder . yield val
426
424
end
427
425
end
You can’t perform that action at this time.
0 commit comments