Module: CodeTools::Compiler::LocalVariables

Defined in:
lib/rubinius/code/compiler/locals.rb

Instance Method Summary collapse

Instance Method Details

#allocate_slotObject



30
31
32
# File 'lib/rubinius/code/compiler/locals.rb', line 30

def allocate_slot
  variables.size
end

#local_countObject



10
11
12
# File 'lib/rubinius/code/compiler/locals.rb', line 10

def local_count
  variables.size
end

#local_namesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rubinius/code/compiler/locals.rb', line 14

def local_names
  names = []
  eval_names = []
  variables.each_pair do |name, var|
    case var
    when EvalLocalVariable
      eval_names << name
    when LocalVariable
      names[var.slot] = name
    # We ignore NestedLocalVariables because they're
    # tagged as existing only in their source scope.
    end
  end
  names += eval_names
end

#variablesObject



6
7
8
# File 'lib/rubinius/code/compiler/locals.rb', line 6

def variables
  @variables ||= {}
end