Class: Duby::AST::JRubyAst::LocalAsgnNode

Inherits:
Object
  • Object
show all
Defined in:
lib/duby/transform.rb

Instance Method Summary collapse

Instance Method Details

#transform(transformer, parent) ⇒ Object



871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'lib/duby/transform.rb', line 871

def transform(transformer, parent)
  case value_node
  when SymbolNode, ConstNode
    LocalDeclaration.new(parent, position, name) {|local_decl| [value_node.type_reference(local_decl)]}
  when JRubyAst::GlobalVarNode
    real_parent = parent
    real_parent = parent.parent if Body === real_parent
    if value_node.name == '$!' && RescueClause === real_parent
      real_parent.name = name
      Noop.new(parent, position)
    else
      raise "Illegal global variable"
    end
  else
    LocalAssignment.new(parent, position, name) {|local| [transformer.transform(value_node, local)]}
  end
end