class CodeTools::AST::BackRef

Constants

Kinds

Attributes

kind[RW]

Public Class Methods

new(line, ref) click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 7
def initialize(line, ref)
  @line = line
  @kind = ref
end

Public Instance Methods

bytecode(g) click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 28
def bytecode(g)
  pos(g)
  g.last_match mode, 0
end
defined(g) click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 33
def defined(g)
  if @kind == :~
    g.push_literal "global-variable"
    g.string_dup
    return
  end

  f = g.new_label
  done = g.new_label

  g.last_match mode, 0
  g.goto_if_nil f

  g.push_literal "global-variable"
  g.string_dup

  g.goto done

  f.set!
  g.push_tagged_nil 0

  done.set!
end
mode() click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 20
def mode
  unless mode = Kinds[@kind]
    raise "Unknown backref: #{@kind}"
  end

  mode
end
to_sexp() click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 57
def to_sexp
  [:back_ref, @kind]
end