Class: RedParse::RescueHeaderNode

Inherits:
Node
  • Object
show all
Defined in:
lib/redparse/node.rb

Overview

not to appear in final tree

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 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!, #initialize_ivars, inline_symbols, #inspect, #lhs_unparse, #linerange, #lvalue, #lvars_defined_in, #merge_replacement_session, namelist, #negate, #original_brackets_assign, param_names, #parsetree, #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

#initialize(rescueword, arrowword, exceptions, thenword) ⇒ RescueHeaderNode

Returns a new instance of RescueHeaderNode.



4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
# File 'lib/redparse/node.rb', line 4907

def initialize(rescueword,arrowword,exceptions,thenword)
  @offset=rescueword.offset
  case exceptions
  when nil
  when VarNode
    if arrowword
      exvarname=exceptions
      exceptions=nil
      arrowword=nil
    end
  when ArrowOpNode
    exvarname=exceptions.last
    exceptions=exceptions.first
  when CommaOpNode
    lastexpr=exceptions.last
    if ArrowOpNode===lastexpr
      exceptions[-1]=lastexpr.left
      exvarname=lastexpr.right
    end
    exceptions=Array.new(exceptions)
  end
  fail if arrowword
#        fail unless VarNode===exvarname || exvarname.nil?
  super(exceptions,exvarname)
end

Instance Method Details

#imageObject



4933
# File 'lib/redparse/node.rb', line 4933

def image; "(rescue=>)" end