Class: CodeTools::AST::DefineSingleton
- Defined in:
- lib/rubinius/code/ast/definitions.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(line, receiver, name, block) ⇒ DefineSingleton
constructor
A new instance of DefineSingleton.
- #to_sexp ⇒ Object
Methods inherited from Node
#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Constructor Details
#initialize(line, receiver, name, block) ⇒ DefineSingleton
Returns a new instance of DefineSingleton.
295 296 297 298 299 |
# File 'lib/rubinius/code/ast/definitions.rb', line 295 def initialize(line, receiver, name, block) @line = line @receiver = receiver @body = DefineSingletonScope.new line, name, block end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
293 294 295 |
# File 'lib/rubinius/code/ast/definitions.rb', line 293 def body @body end |
#receiver ⇒ Object
Returns the value of attribute receiver.
293 294 295 |
# File 'lib/rubinius/code/ast/definitions.rb', line 293 def receiver @receiver end |
Instance Method Details
#bytecode(g) ⇒ Object
301 302 303 304 305 |
# File 'lib/rubinius/code/ast/definitions.rb', line 301 def bytecode(g) pos(g) @body.bytecode(g, @receiver) end |
#to_sexp ⇒ Object
307 308 309 310 |
# File 'lib/rubinius/code/ast/definitions.rb', line 307 def to_sexp [:defs, @receiver.to_sexp, @body.name, @body.arguments.to_sexp, [:scope, @body.body.to_sexp]] end |