remove the parse code and fix the rest to work with the gem (from git for now)
This commit is contained in:
@ -2,13 +2,7 @@ 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
|
||||
# attr_reader :name, :args , :receiver
|
||||
|
||||
def compile context , into
|
||||
params = args.collect{ |a| a.compile(context, into) }
|
||||
@ -37,28 +31,10 @@ module Ast
|
||||
puts "compile call #{function.return_type}"
|
||||
function.return_type
|
||||
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
|
||||
def attributes
|
||||
[:name , :args , :receiver]
|
||||
end
|
||||
end
|
||||
|
||||
class VariableExpression < CallSiteExpression
|
||||
|
||||
def initialize name
|
||||
super( :_get_instance_variable , [StringExpression.new(name)] )
|
||||
end
|
||||
def inspect
|
||||
self.class.name + ".new(" + args[0].string.inspect + ")"
|
||||
end
|
||||
|
||||
# super( :_get_instance_variable , [StringExpression.new(name)] )
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user