2018-03-13 08:00:51 +01:00
|
|
|
module Mom
|
|
|
|
# just name scoping the same stuff to mom
|
|
|
|
# so we know we are on the way down, keeping our layers seperated
|
|
|
|
# and we can put constant adding into the to_risc methods (instead of on vool classes)
|
|
|
|
class Constant
|
|
|
|
end
|
|
|
|
|
|
|
|
class IntegerConstant < Constant
|
|
|
|
attr_reader :value
|
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Integer).instance_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class FloatConstant < Constant
|
|
|
|
attr_reader :value
|
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
|
|
|
def ct_type
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TrueConstant < Constant
|
|
|
|
def ct_type
|
2018-03-19 16:48:56 +01:00
|
|
|
Parfait.object_space.get_class_by_name(:TrueClass).instance_type
|
2018-03-13 08:00:51 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
class FalseConstant < Constant
|
|
|
|
def ct_type
|
2018-03-19 16:48:56 +01:00
|
|
|
Parfait.object_space.get_class_by_name(:FalseClass).instance_type
|
2018-03-13 08:00:51 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
class NilConstant < Constant
|
|
|
|
def ct_type
|
2018-03-19 16:48:56 +01:00
|
|
|
Parfait.object_space.get_class_by_name(:NilClass).instance_type
|
2018-03-13 08:00:51 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
class StringConstant < Constant
|
|
|
|
attr_reader :value
|
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
|
|
|
end
|
2018-03-25 12:27:15 +02:00
|
|
|
class SymbolConstant < Constant
|
2018-03-13 08:00:51 +01:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|