mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
YJIT: Implement codegen for Kernel#block_given? (#7202)
This commit is contained in:
parent
2181a66374
commit
2a0bf269c9
Notes:
git
2023-01-31 15:11:31 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
3 changed files with 34 additions and 9 deletions
|
@ -118,7 +118,7 @@ module Kernel
|
|||
# 2.then.detect(&:odd?) # => nil
|
||||
#
|
||||
def then
|
||||
unless Primitive.block_given_p
|
||||
unless block_given?
|
||||
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, rb_obj_size)'
|
||||
end
|
||||
yield(self)
|
||||
|
@ -142,7 +142,7 @@ module Kernel
|
|||
# then {|response| JSON.parse(response) }
|
||||
#
|
||||
def yield_self
|
||||
unless Primitive.block_given_p
|
||||
unless block_given?
|
||||
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, rb_obj_size)'
|
||||
end
|
||||
yield(self)
|
||||
|
@ -178,7 +178,7 @@ module Kernel
|
|||
# puts enum.next
|
||||
# } #=> :ok
|
||||
def loop
|
||||
unless Primitive.block_given_p
|
||||
unless block_given?
|
||||
return enum_for(:loop) { Float::INFINITY }
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue