class CodeTools::AST::EndData

Attributes

data[RW]

Public Class Methods

new(offset, body) click to toggle source
# File lib/rubinius/code/ast/data.rb, line 7
def initialize(offset, body)
  @offset = offset
  @body = body || NilLiteral.new(1)
end

Public Instance Methods

bytecode(g) click to toggle source

When a script includes __END__, Ruby makes the data after it available as an IO instance via the DATA constant. Since code in the toplevel can access this constant, we have to set it up before any other code runs. This AST node wraps the top node returned by the file parser.

# File lib/rubinius/code/ast/data.rb, line 17
def bytecode(g)
  g.push_rubinius
  g.push_scope
  g.send :data_path, 0
  g.push_int @offset
  g.send :set_data, 2
  g.pop

  @body.bytecode(g)
end