Class: Rubinius::ToolSet.current::TS::AST::DefineSingleton

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/ast/definitions.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

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.



244
245
246
247
248
# File 'lib/rubinius/ast/definitions.rb', line 244

def initialize(line, receiver, name, block)
  @line = line
  @receiver = receiver
  @body = DefineSingletonScope.new line, name, block
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



242
243
244
# File 'lib/rubinius/ast/definitions.rb', line 242

def body
  @body
end

#receiverObject

Returns the value of attribute receiver.



242
243
244
# File 'lib/rubinius/ast/definitions.rb', line 242

def receiver
  @receiver
end

Instance Method Details

#bytecode(g) ⇒ Object



250
251
252
253
254
# File 'lib/rubinius/ast/definitions.rb', line 250

def bytecode(g)
  pos(g)

  @body.bytecode(g, @receiver)
end

#to_sexpObject



256
257
258
259
# File 'lib/rubinius/ast/definitions.rb', line 256

def to_sexp
  [:defs, @receiver.to_sexp, @body.name,
    @body.arguments.to_sexp, [:scope, @body.body.to_sexp]]
end