Class: RedParse::MultiAssignNode

Inherits:
ValueNode show all
Defined in:
lib/redparse/node.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.rb

Overview

obsolete

Constant Summary

Constants included from FlattenedIvars

FlattenedIvars::EXCLUDED_IVARS

Instance Attribute Summary

Attributes inherited from Node

#endline, #errors, #offset, #parent, #startline

Attributes included from Stackable::Meta

#boolean_identity_params, #identity_params

Instance Method Summary collapse

Methods inherited from ValueNode

#lvalue, #reducer_method

Methods inherited from Node

#+, #+@, #==, [], #[]=, #add_parent_links!, #args_rip, #begin_parsetree, #classic_inspect, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #force_stmt_list_rip, #image, #initialize, #initialize_ivars, inline_symbols, #inspect, #lhs_unparse, #linerange, #lvalue, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #parsetrees, #pretty_print, #prohibit_fixup, #replace_ivars_and_self, #replace_value, #rescue_parsetree, #rfind, #rfind_all, #rgrep, #rip_and_rescues, #rip_explode!, #short_inspect, #stmts_rip, #to_parsetree, #to_parsetree_and_warnings, #to_ruby, #to_s, #unary, #walk, #xform_tree!

Methods included from Stackable::Meta

#build_exemplars, #enumerate_exemplars, #identity_param

Methods included from FlattenedIvars

#flattened_ivars, #flattened_ivars_equal?

Methods included from Stackable

#identity_name

Constructor Details

This class inherits a constructor from RedParse::Node

Instance Method Details

#parsetree(o) ⇒ Object

not called from parse table



2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
# 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

#reducer_identObject



17615
17616
17617
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17615

def reducer_ident
  :MultiAssignNode
end