Class: RedParse::MetaClassNode

Inherits:
NamespaceNode show all
Defined in:
lib/redparse/node.rb,
lib/redparse/ripper.rb,
lib/redparse/ReduceWithsFor_RedParse_1_9.rb,
lib/redparse/ReduceWithsFor_RedParse_1_8.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 HasRescue

#parsetree_and_rescues, #unparse_and_rescues

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

#initialize(classword, leftleftword, val, semiword, body, rescues, else_, ensure_, endword) ⇒ MetaClassNode

Returns a new instance of MetaClassNode.



5163
5164
5165
5166
5167
5168
5169
# File 'lib/redparse/node.rb', line 5163

def initialize classword, leftleftword, val, semiword, body, rescues,else_,ensure_, endword
  @offset=classword.offset
  else_=else_.val if else_
  ensure_=ensure_.val if ensure_
  rescues.extend ListInNode if rescues
  super(val,body,rescues,else_,ensure_)
end

Instance Method Details

#imageObject



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

def image; "(class<<)" end

#parsetree(o) ⇒ Object



5187
5188
5189
5190
5191
# File 'lib/redparse/node.rb', line 5187

def parsetree(o)
  result=[:sclass, expr.parsetree(o), scope=[:scope]]
  scope << parsetree_and_rescues(o) if body
  return result
end

#reducer_identObject



17475
17476
17477
# File 'lib/redparse/ReduceWithsFor_RedParse_1_9.rb', line 17475

def reducer_ident
  :MetaClassNode
end

#rip(p) ⇒ Object



283
284
285
# File 'lib/redparse/ripper.rb', line 283

def rip p
  p.on_sclass( object.rip(p), rip_and_rescues(p) )
end

#unparse(o = default_unparse_options) ⇒ Object



5183
5184
5185
# File 'lib/redparse/node.rb', line 5183

def unparse o=default_unparse_options
  "class << #{obj.unparse o}#{unparse_nl(body||self,o)}#{unparse_and_rescues(o)};end"
end