Skip to content

Commit b8a8243

Browse files
committed
Rename Primitive.object_class to Primitive.class
1 parent 7341767 commit b8a8243

39 files changed

+121
-121
lines changed

lib/truffle/objspace.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def count_nodes(nodes = {})
5656

5757
def count_objects_size(hash = {})
5858
ObjectSpace.each_object do |obj|
59-
class_name = Primitive.object_class(obj).name
59+
class_name = Primitive.class(obj).name
6060
if class_name
6161
class_name_sym = class_name.to_sym
6262
hash[class_name_sym] = hash.fetch(class_name_sym, 0) + ObjectSpace.memsize_of(obj)
@@ -69,7 +69,7 @@ def count_objects_size(hash = {})
6969

7070
def count_tdata_objects(hash = {})
7171
ObjectSpace.each_object do |object|
72-
klass = Primitive.object_class(object)
72+
klass = Primitive.class(object)
7373
hash[klass] ||= 0
7474
hash[klass] += 1
7575
end
@@ -82,7 +82,7 @@ def _dump(object, output)
8282
require 'json'
8383
json = {
8484
address: '0x' + object.object_id.to_s(16),
85-
class: '0x' + Primitive.object_class(object).object_id.to_s(16),
85+
class: '0x' + Primitive.class(object).object_id.to_s(16),
8686
memsize: memsize_of(object),
8787
flags: { }
8888
}

lib/truffle/truffle/cext.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def rbimpl_rtypeddata_p(obj)
266266
end
267267

268268
def ensure_class(obj, klass, message = 'expected class %s, but object class is %s')
269-
raise TypeError, format(message, klass, Primitive.object_class(obj)) unless Primitive.is_a?(obj, klass)
269+
raise TypeError, format(message, klass, Primitive.class(obj)) unless Primitive.is_a?(obj, klass)
270270
end
271271

272272
def rb_method_boundp(klass, id, ex)
@@ -278,7 +278,7 @@ def rb_method_boundp(klass, id, ex)
278278
end
279279

280280
def rb_obj_is_instance_of(object, ruby_class)
281-
Primitive.object_class(object) == ruby_class
281+
Primitive.class(object) == ruby_class
282282
end
283283

284284
def rb_obj_is_kind_of(object, ruby_class)
@@ -443,11 +443,11 @@ def rb_hash_start(h)
443443
end
444444

445445
def rb_obj_class(object)
446-
Primitive.object_class(object)
446+
Primitive.class(object)
447447
end
448448

449449
def rb_obj_classname(object)
450-
Primitive.object_class(object).name
450+
Primitive.class(object).name
451451
end
452452

453453
def rb_class_of(object)

src/main/java/org/truffleruby/core/support/TypeNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ protected boolean respondTo(Object object, Object name, boolean includePrivate,
8585
}
8686
}
8787

88-
@Primitive(name = "object_class")
89-
public abstract static class ObjectClassNode extends PrimitiveArrayArgumentsNode {
88+
@Primitive(name = "class")
89+
public abstract static class ClassPrimitiveNode extends PrimitiveArrayArgumentsNode {
9090
@Specialization
9191
protected RubyClass objectClass(Object object,
9292
@Cached LogicalClassNode logicalClassNode) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def flatten!(level = -1)
508508
level = Primitive.rb_num2int level
509509
return nil if level == 0
510510

511-
out = Primitive.object_class(self).allocate # new_reserved size
511+
out = Primitive.class(self).allocate # new_reserved size
512512
if Primitive.array_flatten_helper(self, out, level)
513513
Primitive.steal_array_storage(self, out)
514514
return self
@@ -1286,7 +1286,7 @@ def to_h
12861286
each_with_index do |elem, i|
12871287
elem = yield(elem) if block_given?
12881288
unless elem.respond_to?(:to_ary)
1289-
raise TypeError, "wrong element type #{Primitive.object_class(elem)} at #{i} (expected array)"
1289+
raise TypeError, "wrong element type #{Primitive.class(elem)} at #{i} (expected array)"
12901290
end
12911291

12921292
ary = elem.to_ary
@@ -1365,7 +1365,7 @@ def zip(*others)
13651365
elsif Primitive.respond_to?(other, :each, false)
13661366
other.to_enum(:each)
13671367
else
1368-
raise TypeError, "wrong argument type #{Primitive.object_class(other)} (must respond to :each)"
1368+
raise TypeError, "wrong argument type #{Primitive.class(other)} (must respond to :each)"
13691369
end
13701370
end
13711371

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def between?(min, max)
8282
def clamp(min, max = undefined)
8383
if Primitive.undefined?(max)
8484
range = min
85-
raise TypeError, "wrong argument type #{Primitive.object_class(range)} (expected Range)" unless Primitive.is_a?(range, Range)
85+
raise TypeError, "wrong argument type #{Primitive.class(range)} (expected Range)" unless Primitive.is_a?(range, Range)
8686
raise ArgumentError, 'cannot clamp with an exclusive range' if range.exclude_end?
8787
min, max = range.begin, range.end
8888
end

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ def ==(other)
199199

200200
def eql?(other)
201201
Primitive.is_a?(other, Complex) and
202-
Primitive.object_class(imag) == Primitive.object_class(other.imag) and
203-
Primitive.object_class(real) == Primitive.object_class(other.real) and
202+
Primitive.class(imag) == Primitive.class(other.imag) and
203+
Primitive.class(real) == Primitive.class(other.real) and
204204
self == other
205205
end
206206

@@ -210,7 +210,7 @@ def coerce(other)
210210
elsif Primitive.is_a?(other, Complex)
211211
[other, self]
212212
else
213-
raise TypeError, "#{Primitive.object_class(other)} can't be coerced into Complex"
213+
raise TypeError, "#{Primitive.class(other)} can't be coerced into Complex"
214214
end
215215
end
216216

@@ -305,7 +305,7 @@ def inspect
305305
end
306306

307307
def fdiv(other)
308-
raise TypeError, "#{Primitive.object_class(other)} can't be coerced into Complex" unless Primitive.is_a?(other, Numeric)
308+
raise TypeError, "#{Primitive.class(other)} can't be coerced into Complex" unless Primitive.is_a?(other, Numeric)
309309

310310
# FIXME
311311
self / other

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def each_child
141141
end
142142

143143
def inspect
144-
"#<#{Primitive.object_class(self)}:#{@path}>"
144+
"#<#{Primitive.class(self)}:#{@path}>"
145145
end
146146

147147
class << self

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def to_h(*arg)
319319
each_with_index(*arg) do |elem, i|
320320
elem = yield(elem) if block_given?
321321
unless elem.respond_to?(:to_ary)
322-
raise TypeError, "wrong element type #{Primitive.object_class(elem)} at #{i} (expected array)"
322+
raise TypeError, "wrong element type #{Primitive.class(elem)} at #{i} (expected array)"
323323
end
324324

325325
ary = elem.to_ary
@@ -342,7 +342,7 @@ def zip(*enums)
342342
elsif Primitive.respond_to?(enum, :each, false)
343343
enum.to_enum(:each)
344344
else
345-
raise TypeError, "wrong argument type #{Primitive.object_class(enum)} (must respond to :each)"
345+
raise TypeError, "wrong argument type #{Primitive.class(enum)} (must respond to :each)"
346346
end
347347
end
348348

@@ -798,7 +798,7 @@ def min_max(relative)
798798
else
799799
comp = block_given? ? yield(o, chosen) : o <=> chosen
800800
unless comp
801-
raise ArgumentError, "comparison of #{Primitive.object_class(o)} with #{chosen} failed"
801+
raise ArgumentError, "comparison of #{Primitive.class(o)} with #{chosen} failed"
802802
end
803803

804804
if (Comparable.compare_int(comp) <=> 0) == relative

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ class Enumerator
7070
end
7171

7272
def inspect
73-
return "#<#{Primitive.object_class(self)}: uninitialized>" if Primitive.nil?(@object) && Primitive.nil?(@iter)
73+
return "#<#{Primitive.class(self)}: uninitialized>" if Primitive.nil?(@object) && Primitive.nil?(@iter)
7474

7575
args = @kwargs.empty? ? @args : [*@args, @kwargs]
7676
args = args.empty? ? '' : "(#{args.map(&:inspect).join(', ')})"
77-
"#<#{Primitive.object_class(self)}: #{@object.inspect}:#{@iter}#{args}>"
77+
"#<#{Primitive.class(self)}: #{@object.inspect}:#{@iter}#{args}>"
7878
end
7979

8080
def each(*args, **kwargs, &block)
@@ -538,7 +538,7 @@ def zip(*lists)
538538
elsif Primitive.respond_to?(list, :each, false)
539539
list.to_enum :each
540540
else
541-
raise TypeError, "wrong argument type #{Primitive.object_class(list)} (must respond to :each)"
541+
raise TypeError, "wrong argument type #{Primitive.class(list)} (must respond to :each)"
542542
end
543543
end
544544

@@ -795,8 +795,8 @@ def rewind
795795
end
796796

797797
def inspect
798-
return "#<#{Primitive.object_class(self).name}: ...>" if Truffle::ThreadOperations.detect_recursion(self) do
799-
return "#<#{Primitive.object_class(self).name}: #{@enums || "uninitialized"}>"
798+
return "#<#{Primitive.class(self).name}: ...>" if Truffle::ThreadOperations.detect_recursion(self) do
799+
return "#<#{Primitive.class(self).name}: #{@enums || "uninitialized"}>"
800800
end
801801
end
802802
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def to_h
281281
each_pair do |*elem|
282282
elem = yield(elem)
283283
unless elem.respond_to?(:to_ary)
284-
raise TypeError, "wrong element type #{Primitive.object_class(elem)} (expected array)"
284+
raise TypeError, "wrong element type #{Primitive.class(elem)} (expected array)"
285285
end
286286

287287
ary = elem.to_ary

0 commit comments

Comments
 (0)