rename callable to CallStatement

Callable is the Method, whereas here we call the method
This commit is contained in:
Torsten Ruger 2018-07-30 14:44:14 +03:00
parent 9c6a099cde
commit 198a43cc8d
5 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ require_relative "ruby/basic_values"
require_relative "ruby/hash_statement"
require_relative "ruby/method_statement"
require_relative "ruby/ruby_compiler"
require_relative "ruby/callable"
require_relative "ruby/call_statement"
require_relative "ruby/send_statement"
require_relative "ruby/yield_statement"
require_relative "ruby/variables"

View File

@ -11,7 +11,7 @@ module Ruby
case value
when Variable , Constant
return self.vool_brother.new(name,@value.to_vool)
when SendStatement
when SendStatement , YieldStatement
return normalize_send
when BlockStatement
return normalize_block
@ -36,7 +36,7 @@ module Ruby
# plain send
def normalize_send
statements = value.to_vool
return assignment( statements ) if statements.is_a?(Vool::SendStatement)
return assignment( statements ) if statements.is_a?(Vool::CallStatement)
# send has hoisted assigns, so we make an assign out of the "pure" send
statements << assignment(statements.statements.pop)
statements

View File

@ -1,6 +1,6 @@
module Ruby
class Callable < Statement
class CallStatement < Statement
attr_reader :name , :receiver , :arguments
def initialize(name , receiver , arguments )

View File

@ -1,6 +1,6 @@
module Ruby
class SendStatement < Callable
class SendStatement < CallStatement
def to_s
"#{receiver}.#{name}(#{arguments.join(', ')})"
end

View File

@ -1,6 +1,6 @@
module Ruby
class YieldStatement < Callable
class YieldStatement < CallStatement
def initialize(arguments)
super("yield_#{object_id}".to_sym , SelfExpression.new , arguments)