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/hash_statement"
require_relative "ruby/method_statement" require_relative "ruby/method_statement"
require_relative "ruby/ruby_compiler" require_relative "ruby/ruby_compiler"
require_relative "ruby/callable" require_relative "ruby/call_statement"
require_relative "ruby/send_statement" require_relative "ruby/send_statement"
require_relative "ruby/yield_statement" require_relative "ruby/yield_statement"
require_relative "ruby/variables" require_relative "ruby/variables"

View File

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

View File

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

View File

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

View File

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