Class: Rubinius::AST::Define
- Inherits:
-
ClosedScope
- Object
- Node
- ClosedScope
- Rubinius::AST::Define
- Defined in:
- lib/compiler/ast/definitions.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from ClosedScope
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, name, block) ⇒ Define
constructor
A new instance of Define.
- #to_sexp ⇒ Object
Methods inherited from ClosedScope
#assign_local_reference, #module?, #nest_scope, #new_local, #new_nested_local, #search_local
Methods included from Compiler::LocalVariables
#allocate_slot, #local_count, #local_names, #variables
Methods inherited from Node
#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk
Constructor Details
#initialize(line, name, block) ⇒ Define
Returns a new instance of Define.
120 121 122 123 124 125 126 |
# File 'lib/compiler/ast/definitions.rb', line 120 def initialize(line, name, block) @line = line @name = name @arguments = block.strip_arguments block.array << NilLiteral.new(line) if block.array.empty? @body = block end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
118 119 120 |
# File 'lib/compiler/ast/definitions.rb', line 118 def arguments @arguments end |
#name ⇒ Object
Returns the value of attribute name.
118 119 120 |
# File 'lib/compiler/ast/definitions.rb', line 118 def name @name end |
Instance Method Details
#to_sexp ⇒ Object
128 129 130 |
# File 'lib/compiler/ast/definitions.rb', line 128 def to_sexp [:defn, @name, @arguments.to_sexp, [:scope, @body.to_sexp]] end |