Class: Object

Inherits:
BasicObject
Includes:
Kernel
Defined in:
lib/rlang/lib/object.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Kernel

#print, #puts, #raise

Class Method Details

.allocate(nbytes) ⇒ Object



15
16
17
18
# File 'lib/rlang/lib/object.rb', line 15

def self.allocate(nbytes)
  result :I32
  Malloc.malloc(nbytes)
end

.free(object_ptr) ⇒ Object



20
21
22
23
# File 'lib/rlang/lib/object.rb', line 20

def self.free(object_ptr)
  result :none
  Malloc.free(object_ptr)
end

Instance Method Details

#!=(object) ⇒ Object



48
49
50
# File 'lib/rlang/lib/object.rb', line 48

def !=(object)
  !(self == object)
end

#==(object) ⇒ Object



44
45
46
# File 'lib/rlang/lib/object.rb', line 44

def ==(object)
  self.eql?(object)
end

#eql?(object) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
# File 'lib/rlang/lib/object.rb', line 35

def eql?(object)
  result :I32
  inline wat: '(i32.eq 
    (local.get $_self_)
    (local.get $object))',
         wtype: :I32,
         ruby: 'self.object_id == object.object_id'
end

#object_idObject



30
31
32
33
# File 'lib/rlang/lib/object.rb', line 30

def object_id
  result :I32
  self
end

#to_sObject



25
26
27
28
# File 'lib/rlang/lib/object.rb', line 25

def to_s
  result :String
  "Object <addr>"
end