YJIT: Implement codegen for Kernel#block_given? (#7202)

This commit is contained in:
Takashi Kokubun 2023-01-31 07:11:10 -08:00 committed by GitHub
parent 2181a66374
commit 2a0bf269c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

View file

@ -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