2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
|
|
|
|
2018-09-01 14:54:25 +02:00
|
|
|
# Send and yield are very very similar, so they have a base class CallStatement
|
|
|
|
#
|
|
|
|
# The YieldStatement really only provides to_s, and has slightly
|
|
|
|
# different constructor. See CallStatement
|
|
|
|
#
|
2018-07-30 13:44:14 +02:00
|
|
|
class YieldStatement < CallStatement
|
2018-07-19 13:46:51 +02:00
|
|
|
|
2018-09-01 14:54:25 +02:00
|
|
|
# We give the instance of the yield and auto generated name
|
|
|
|
# Also, a yield is always (for now) on self
|
2018-07-21 13:34:39 +02:00
|
|
|
def initialize(arguments)
|
|
|
|
super("yield_#{object_id}".to_sym , SelfExpression.new , arguments)
|
2018-07-19 13:46:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
2018-07-21 13:34:39 +02:00
|
|
|
"yield(#{arguments.join(', ')})"
|
2018-07-19 13:46:51 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|