Class: RedParse::AccessorAssignNode

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



2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
# File 'lib/redparse/node.rb', line 2802

def parsetree(o)
  op=op().ident.chomp('=')
  rcvr=left.parsetree(o)
  prop=property.ident.<<(?=).to_sym
  rhs=right.parsetree(o)
  if op.empty?
    [:attrasgn, rcvr, prop, [:array, args] ]
  else
    [:op_asgn2, rcvr,prop,  op.to_sym, args]
  end
end

#reducer_identObject



17530
17531
17532
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17530

def reducer_ident
  :AccessorAssignNode
end

#to_lispObject



2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
# File 'lib/redparse/node.rb', line 2790

def to_lisp
  if op.ident=='='
    "(#{left.to_lisp} #{property.ident}= #{right.to_lisp})"
  else
    op=op().ident.chomp('=')
    varname=nil
    "(let #{varname=huh} #{left.to_lisp} "+
      "(#{varname} #{property.ident}= "+
        "(#{op} (#{varname} #{property.ident}) #{right.to_lisp})))"
  end
end