Class: Baba::Stmt::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/baba/stmt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, params, body) ⇒ Function

Returns a new instance of Function.



42
43
44
# File 'lib/baba/stmt.rb', line 42

def initialize(name, params, body)
  @name = name; @params = params; @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



40
41
42
# File 'lib/baba/stmt.rb', line 40

def body
  @body
end

#nameObject (readonly)

Returns the value of attribute name.



40
41
42
# File 'lib/baba/stmt.rb', line 40

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



40
41
42
# File 'lib/baba/stmt.rb', line 40

def params
  @params
end

Instance Method Details

#accept(visitor) ⇒ Object



46
47
48
# File 'lib/baba/stmt.rb', line 46

def accept(visitor)
  visitor.visit_function_stmt(self)
end