remove the parse code and fix the rest to work with the gem (from git for now)
This commit is contained in:
@ -1,26 +1,6 @@
|
||||
module Ast
|
||||
class FunctionExpression < Expression
|
||||
attr_reader :name, :params, :body , :receiver
|
||||
def initialize name, params, body , receiver = nil
|
||||
@name = name.to_sym
|
||||
@params = params
|
||||
@body = body
|
||||
@receiver = receiver
|
||||
end
|
||||
def attributes
|
||||
[:name, :params, :body , :receiver]
|
||||
end
|
||||
def inspect
|
||||
self.class.name + ".new(" + name.inspect + ", ["+
|
||||
params.collect{|m| m.inspect }.join( ",") +"] , [" +
|
||||
body.collect{|m| m.inspect }.join( ",") +"] ,"+ receiver.inspect + " )"
|
||||
end
|
||||
|
||||
def to_s
|
||||
ret = "def "
|
||||
ret += "#{receiver}." if receiver
|
||||
ret + "#{name}( " + params.join(",") + ") \n" + body.join("\n") + "end\n"
|
||||
end
|
||||
# attr_reader :name, :params, :body , :receiver
|
||||
def compile context , into
|
||||
raise "function does not compile into anything #{self}" if into
|
||||
args = []
|
||||
@ -67,6 +47,5 @@ module Ast
|
||||
context.function = parent_function
|
||||
function
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user