2014-06-04 18:59:38 +02:00
|
|
|
module Ast
|
|
|
|
# assignment, like operators are really function calls
|
2015-07-11 21:00:11 +02:00
|
|
|
|
2014-06-04 18:59:38 +02:00
|
|
|
class CallSiteExpression < Expression
|
|
|
|
attr_reader :name, :args , :receiver
|
|
|
|
|
|
|
|
def initialize name, args , receiver = Ast::NameExpression.new(:self)
|
|
|
|
@name = name.to_sym
|
2015-07-11 21:00:11 +02:00
|
|
|
@args = args
|
2014-06-04 18:59:38 +02:00
|
|
|
@receiver = receiver
|
|
|
|
end
|
2015-07-11 21:00:11 +02:00
|
|
|
def attributes
|
|
|
|
[:name , :args , :receiver]
|
|
|
|
end
|
2014-06-04 18:59:38 +02:00
|
|
|
|
|
|
|
def inspect
|
2015-07-11 21:00:11 +02:00
|
|
|
self.class.name + ".new(" + name.inspect + ", ["+
|
|
|
|
args.collect{|m| m.inspect }.join( ",") + "] ," + receiver.inspect + ")"
|
2014-06-04 18:59:38 +02:00
|
|
|
end
|
|
|
|
def to_s
|
|
|
|
"#{name}(" + args.join(",") + ")"
|
|
|
|
end
|
2015-07-11 21:00:11 +02:00
|
|
|
end
|
|
|
|
end
|