add qualification to function definitions

This commit is contained in:
Torsten Ruger
2014-06-02 14:00:30 +03:00
parent 1cff296ab5
commit 7c1c5431bc
4 changed files with 41 additions and 48 deletions

View File

@ -1,16 +1,19 @@
module Ast
class FunctionExpression < Expression
attr_reader :name, :params, :body
def initialize name, params, body
@name, @params, @body = name.to_sym, params, body
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]
[: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( ",") +"] )"
body.collect{|m| m.inspect }.join( ",") +"] ,"+ receiver.inspect + " )"
end
def to_s