Class: RedParse::AliasNode

Inherits:
ValueNode show all
Includes:
BareSymbolUtils
Defined in:
lib/redparse/node.rb

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 included from BareSymbolUtils

#baresym2str, #str2parsetree, #str_unparse

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!, #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

#initialize(aliasword, to, from) ⇒ AliasNode



4716
4717
4718
4719
4720
4721
# File 'lib/redparse/node.rb', line 4716

def initialize(aliasword,to,from)
  @offset=aliasword.offset
  to=baresym2str(to)
  from=baresym2str(from)
  super(to,from)
end

Instance Method Details

#imageObject



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

def image; "(alias)" end

#parsetree(o) ⇒ Object



4728
4729
4730
4731
4732
4733
4734
# File 'lib/redparse/node.rb', line 4728

def parsetree(o)
  if VarNode===to and to.ident[0]==?$
    [:valias, to.ident.to_sym, from.ident.to_sym]
  else
    [:alias, str2parsetree(to,o), str2parsetree(from,o)]
  end
end

#unparse(o = default_unparse_options) ⇒ Object



4723
4724
4725
# File 'lib/redparse/node.rb', line 4723

def unparse o=default_unparse_options
  "alias #{str_unparse to,o} #{str_unparse from,o}"      
end