Class: IV::Phonic::AST::VariableStatement
- Defined in:
- lib/iv/phonic/ast.rb
Instance Method Summary collapse
-
#initialize(parent, stmt) ⇒ VariableStatement
constructor
A new instance of VariableStatement.
- #to_source(lv) ⇒ Object
Methods inherited from Statement
Methods inherited from Node
#begin_position, #end_position, #program, #source
Constructor Details
#initialize(parent, stmt) ⇒ VariableStatement
Returns a new instance of VariableStatement.
97 98 99 100 101 |
# File 'lib/iv/phonic/ast.rb', line 97 def initialize parent, stmt super parent, stmt @body = stmt[:body].map{|decl| Declaration.new self, decl } @const = stmt[:const] end |
Instance Method Details
#to_source(lv) ⇒ Object
103 104 105 |
# File 'lib/iv/phonic/ast.rb', line 103 def to_source lv "#{@const ? 'const' : 'var' } #{ @body.map{|decl| decl.to_source lv }.join(', ') };".indent(lv) end |