Class: RedParse::BlockParams
- Inherits:
-
AssigneeList
- Object
- Array
- Node
- ValueNode
- AssigneeList
- RedParse::BlockParams
- 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
-
#initialize(data) ⇒ BlockParams
constructor
A new instance of BlockParams.
- #parsetree(o) ⇒ Object
- #unparse(o = default_unparse_options) ⇒ Object
Methods inherited from AssigneeList
#all_current_lvars, #lvalue_parsetree, #old_parsetree
Methods inherited from ValueNode
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_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
Constructor Details
#initialize(data) ⇒ BlockParams
Returns a new instance of BlockParams.
2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 |
# File 'lib/redparse/node.rb', line 2759 def initialize(data) item=data.first if data.size==1 #elide 1 layer of parens if present if ParenedNode===item item=item.first data=CommaOpNode===item ? Array.new(item) : [item] @had_parens=true end data= Array.new(data) if CommaOpNode===data super(data) unless data.empty? end |
Instance Method Details
#parsetree(o) ⇒ Object
2780 2781 2782 2783 2784 |
# File 'lib/redparse/node.rb', line 2780 def parsetree o result=super result.push nil if UnaryStarNode===self.last || size>1 #and o[:ruby187] result end |
#unparse(o = default_unparse_options) ⇒ Object
2772 2773 2774 2775 2776 2777 2778 |
# File 'lib/redparse/node.rb', line 2772 def unparse o= if defined? @had_parens "|("+super+")|" else "|"+super+"|" end end |