Class: Atomy::Code::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/atomy/code/variable.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Variable

Returns a new instance of Variable.



4
5
6
# File 'lib/atomy/code/variable.rb', line 4

def initialize(name)
  @name = name
end

Instance Method Details

#bytecode(gen, mod) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/atomy/code/variable.rb', line 8

def bytecode(gen, mod)
  if local = gen.state.scope.search_local(@name)
    local.get_bytecode(gen)
  else
    Send.new(nil, @name).bytecode(gen, mod)
  end
end