2017-04-01 21:28:57 +03:00
|
|
|
module Vool
|
2017-09-10 12:57:25 +03:00
|
|
|
class Statement
|
|
|
|
def slot_class
|
|
|
|
Mom::SlotMove
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class ConstantStatement < Statement
|
|
|
|
def slot_class
|
|
|
|
Mom::SlotConstant
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class IntegerStatement < ConstantStatement
|
2017-04-06 16:06:51 +03:00
|
|
|
attr_reader :value
|
2017-04-01 21:28:57 +03:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2018-03-13 12:30:51 +05:30
|
|
|
def to_mom(method)
|
|
|
|
return Mom::IntegerConstant.new(@value)
|
|
|
|
end
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Integer).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-09-10 12:57:25 +03:00
|
|
|
class FloatStatement < ConstantStatement
|
2017-04-06 16:06:51 +03:00
|
|
|
attr_reader :value
|
2017-04-01 21:28:57 +03:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
true
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-09-10 12:57:25 +03:00
|
|
|
class TrueStatement < ConstantStatement
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:True).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-09-10 12:57:25 +03:00
|
|
|
class FalseStatement < ConstantStatement
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:False).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-09-10 12:57:25 +03:00
|
|
|
class NilStatement < ConstantStatement
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Nil).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-04-02 12:59:07 +03:00
|
|
|
class SelfStatement < Statement
|
2017-04-25 09:40:09 +03:00
|
|
|
attr_reader :clazz
|
|
|
|
def set_class(clazz)
|
|
|
|
@clazz = clazz
|
|
|
|
end
|
2018-03-13 12:30:51 +05:30
|
|
|
def to_mom(in_method)
|
|
|
|
Mom::SlotDefinition.new(:message , [:self])
|
|
|
|
end
|
2017-04-25 09:40:09 +03:00
|
|
|
def ct_type
|
|
|
|
@clazz.instance_type
|
|
|
|
end
|
2017-04-02 12:59:07 +03:00
|
|
|
end
|
2017-04-02 18:42:52 +03:00
|
|
|
class SuperStatement < Statement
|
|
|
|
end
|
2017-09-10 12:57:25 +03:00
|
|
|
class StringStatement < ConstantStatement
|
2017-04-06 16:06:51 +03:00
|
|
|
attr_reader :value
|
2017-04-01 21:28:57 +03:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2018-03-13 12:30:51 +05:30
|
|
|
def to_mom(method)
|
|
|
|
return Mom::StringConstant.new(@value)
|
|
|
|
end
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
2017-04-02 10:43:22 +03:00
|
|
|
class SymbolStatement < StringStatement
|
2017-04-19 20:59:13 +03:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
2017-04-01 21:28:57 +03:00
|
|
|
end
|
|
|
|
end
|