2017-04-01 20:28:57 +02:00
|
|
|
module Vool
|
2018-03-15 06:54:14 +01:00
|
|
|
class Constant < Expression
|
2018-03-16 06:33:29 +01:00
|
|
|
#gobble it up
|
|
|
|
def each(&block)
|
|
|
|
end
|
2017-09-10 11:57:25 +02:00
|
|
|
end
|
|
|
|
|
2018-03-15 06:54:14 +01:00
|
|
|
class IntegerConstant < Constant
|
2017-04-06 15:06:51 +02:00
|
|
|
attr_reader :value
|
2017-04-01 20:28:57 +02:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2018-03-15 16:03:38 +01:00
|
|
|
def slot_definition(method)
|
2018-03-13 08:00:51 +01:00
|
|
|
return Mom::IntegerConstant.new(@value)
|
|
|
|
end
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Integer).instance_type
|
|
|
|
end
|
2018-03-15 16:03:38 +01:00
|
|
|
#gobble it up
|
|
|
|
def each(&block)
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class FloatConstant < Constant
|
2017-04-06 15:06:51 +02:00
|
|
|
attr_reader :value
|
2017-04-01 20:28:57 +02:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
true
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class TrueConstant < Constant
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:True).instance_type
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class FalseConstant < Constant
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:False).instance_type
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class NilConstant < Constant
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Nil).instance_type
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class SelfExpression < Expression
|
2018-03-16 06:02:11 +01:00
|
|
|
attr_reader :my_type
|
|
|
|
def initialize(type = nil)
|
|
|
|
@my_type = type
|
|
|
|
end
|
2018-03-13 08:00:51 +01:00
|
|
|
def to_mom(in_method)
|
2018-03-15 08:16:56 +01:00
|
|
|
@clazz = in_method.clazz
|
2018-03-14 15:56:13 +01:00
|
|
|
Mom::SlotDefinition.new(:message , [:receiver])
|
2018-03-13 08:00:51 +01:00
|
|
|
end
|
2017-04-25 08:40:09 +02:00
|
|
|
def ct_type
|
2018-03-16 06:02:11 +01:00
|
|
|
@my_type
|
2017-04-25 08:40:09 +02:00
|
|
|
end
|
2017-04-02 11:59:07 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class SuperExpression < Statement
|
2017-04-02 17:42:52 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class StringConstant < Constant
|
2017-04-06 15:06:51 +02:00
|
|
|
attr_reader :value
|
2017-04-01 20:28:57 +02:00
|
|
|
def initialize(value)
|
|
|
|
@value = value
|
|
|
|
end
|
2018-03-15 16:03:38 +01:00
|
|
|
def slot_definition(method)
|
2018-03-13 08:00:51 +01:00
|
|
|
return Mom::StringConstant.new(@value)
|
|
|
|
end
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
2018-03-15 06:54:14 +01:00
|
|
|
class SymbolConstant < StringConstant
|
2017-04-19 19:59:13 +02:00
|
|
|
def ct_type
|
|
|
|
Parfait.object_space.get_class_by_name(:Word).instance_type
|
|
|
|
end
|
2017-04-01 20:28:57 +02:00
|
|
|
end
|
|
|
|
end
|