class CodeTools::AST::NthRef

Constants

Mode

Attributes

which[RW]

Public Class Methods

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

Public Instance Methods

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

  # These are for $1, $2, etc. We subtract 1 because
  # we start numbering the captures from 0.
  g.last_match Mode, @which - 1
end
defined(g) click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 80
def defined(g)
  f = g.new_label
  done = g.new_label

  g.last_match Mode, @which - 1
  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
to_sexp() click to toggle source
# File lib/rubinius/code/ast/variables.rb, line 98
def to_sexp
  [:nth_ref, @which]
end