95fbc3de1a
as it is essential that attributes are in the same order for the json to work
25 lines
606 B
Ruby
25 lines
606 B
Ruby
module Ast
|
|
# assignment, like operators are really function calls
|
|
|
|
class CallSiteExpression < Expression
|
|
attr_reader :name, :args , :receiver
|
|
|
|
def initialize name, args , receiver = Ast::NameExpression.new(:self)
|
|
@name = name.to_sym
|
|
@args = args
|
|
@receiver = receiver
|
|
end
|
|
def attributes
|
|
[:name , :args , :receiver]
|
|
end
|
|
|
|
def inspect
|
|
self.class.name + ".new(" + name.inspect + ", ["+
|
|
args.collect{|m| m.inspect }.join( ",") + "] ," + receiver.inspect + ")"
|
|
end
|
|
def to_s
|
|
"#{name}(" + args.join(",") + ")"
|
|
end
|
|
end
|
|
end
|