class RedParse::ListInNode::MultiAssignNode

Public Instance Methods

parsetree(o) click to toggle source

not called from parse table

# File lib/redparse/node.rb, line 2610
def parsetree(o)
  lhs=left.dup
  if UnaryStarNode===lhs.last
    lstar=lhs.pop
  end
  lhs.map!{|x| 
    res=x.parsetree(o)
    res[0]=x.varname2assigntype if VarNode===x
    res
  }
  lhs.unshift(:array) if lhs.size>1 or lstar
  rhs=right.map{|x| x.parsetree(o)}
  if rhs.size==1
    if rhs.first.first==:splat 
      rhs=rhs.first
    else
      rhs.unshift :to_ary
    end
  else
    rhs.unshift(:array) 
    if rhs[-1][0]==:splat
      splat=rhs.pop[1]
      if splat.first==:call 
        splat[0]=:attrasgn
        splat[2]="#{splat[2]}=".to_sym
      end
      rhs=[:argscat, rhs, splat] 
    end
  end
  result=[:masgn, lhs, rhs]
  result.insert(2,lstar.data.last.parsetree(o)) if lstar
  result

end