Class: RedParse::MultiAssignNode

Inherits:
ValueNode show all
Defined in:
lib/redparse/node.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

Methods inherited from Node

#+, #+@, #==, [], #[]=, #add_parent_links!, #begin_parsetree, create, #data, #deep_copy, #delete_extraneous_ivars!, #delete_linenums!, #depthwalk, #depthwalk_nodes, #error?, #evalable_inspect, #fixup_multiple_assignments!, #fixup_rescue_assignments!, #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, #to_parsetree, #to_parsetree_and_warnings, #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



2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
# File 'lib/redparse/node.rb', line 2440

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