class CodeTools::AST::SClassScope

Public Class Methods

new(line, body) click to toggle source
# File lib/rubinius/code/ast/definitions.rb, line 1106
def initialize(line, body)
  @line = line
  @body = body
  @name = nil
end

Public Instance Methods

bytecode(g) click to toggle source
# File lib/rubinius/code/ast/definitions.rb, line 1112
def bytecode(g)
  pos(g)

  g.push_type
  g.swap
  g.send :object_singleton_class, 1

  if @body
    # if @body just returns self, don't bother with it.
    if @body.kind_of? Block
      ary = @body.array
      return if ary.size == 1 and ary[0].kind_of? Self
    end

    # Ok, emit it.
    attach_and_call g, :__metaclass_init__, true, true
  else
    g.pop
    g.push_tagged_nil 0
  end
end