Skip to content

Commit 8c776c5

Browse files
committed
Autocorrect and replace Primitive.object_equal with nil argument with Primitive.nil?
1 parent 6c7e8b0 commit 8c776c5

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

src/main/ruby/truffleruby/core/array.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def cycle(n = nil)
323323

324324
return nil if empty?
325325

326-
if Primitive.object_equal(nil, n)
326+
if Primitive.nil?(n)
327327
until empty?
328328
each { |x| yield x }
329329
end

src/main/ruby/truffleruby/core/kernel.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def Float(obj, exception: true)
9090
module_function :Float
9191

9292
def Hash(obj)
93-
return {} if Primitive.object_equal(obj, nil) || obj == []
93+
return {} if Primitive.nil?(obj) || obj == []
9494

9595
if hash = Truffle::Type.rb_check_convert_type(obj, Hash, :to_hash)
9696
return hash

src/main/ruby/truffleruby/core/rational.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def truncate(precision = 0)
330330
end
331331

332332
def self.convert(num, den)
333-
if Primitive.object_equal(num, nil) || Primitive.object_equal(den, nil)
333+
if Primitive.nil?(num) || Primitive.nil?(den)
334334
raise TypeError, 'cannot convert nil into Rational'
335335
end
336336

src/main/ruby/truffleruby/core/truffle/complex_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Truffle
1212
module ComplexOperations
1313
def self.convert_not_real_arguments(real, imag, exception)
1414
raise_exception = !Primitive.object_equal(exception, false)
15-
if Primitive.object_equal(nil, real) || Primitive.object_equal(nil, imag)
15+
if Primitive.nil?(real) || Primitive.nil?(imag)
1616
return nil unless raise_exception
1717
raise TypeError, "can't convert nil into Complex"
1818
end

src/main/ruby/truffleruby/core/truffle/exception_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def self.message_and_class(exception, highlight)
127127
end
128128

129129
def self.full_message(exception, highlight, order)
130-
highlight = if Primitive.object_equal(highlight, nil)
130+
highlight = if Primitive.nil?(highlight)
131131
Exception.to_tty?
132132
else
133133
raise ArgumentError, "expected true of false as highlight: #{highlight}" unless Primitive.object_equal(highlight, true) || Primitive.object_equal(highlight, false)

src/main/ruby/truffleruby/core/truffle/ffi/pointer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def [](idx)
125125
end
126126

127127
def ==(other)
128-
return true if Primitive.object_equal(nil, other) && null?
128+
return true if Primitive.nil?(other) && null?
129129
return false unless Primitive.object_kind_of?(other, Pointer)
130130
address == other.address
131131
end

src/main/ruby/truffleruby/core/truffle/ffi/pointer_access.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ def put_array_of_double(offset, ary)
628628
private def get_pointer_value(value)
629629
if Primitive.object_kind_of?(value, Truffle::FFI::Pointer)
630630
value.address
631-
elsif Primitive.object_equal(nil, value)
631+
elsif Primitive.nil?(value)
632632
0
633633
elsif Primitive.object_kind_of?(value, Integer)
634634
value

src/main/ruby/truffleruby/core/truffle/io_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def self.puts(io, *args)
3232
io.write DEFAULT_RECORD_SEPARATOR
3333
else
3434
args.each do |arg|
35-
if Primitive.object_equal(arg, nil)
35+
if Primitive.nil?(arg)
3636
str = ''
3737
elsif Primitive.object_kind_of?(arg, String)
3838
# might be a Foreign String we need to convert

0 commit comments

Comments
 (0)