class Lignite::RbfDeclarer
Implements pass 1, just gathers names
Public Class Methods
new()
click to toggle source
# File lib/lignite/rbf_declarer.rb, line 15 def initialize # @return [Hash{Symbol => Integer}] @object_names = {} @counter = 0 @dummy_globals = Variables.new end
Public Instance Methods
index_of(name)
click to toggle source
# File lib/lignite/rbf_declarer.rb, line 22 def index_of(name) @object_names[name] end
sub(name, &_body)
click to toggle source
# File lib/lignite/rbf_declarer.rb, line 35 def sub(name, &_body) add(name) end
variables()
click to toggle source
# File lib/lignite/rbf_declarer.rb, line 26 def variables @dummy_globals end
vmthread(name, &_body)
click to toggle source
# File lib/lignite/rbf_declarer.rb, line 31 def vmthread(name, &_body) add(name) end
Private Instance Methods
add(name)
click to toggle source
stupid typeless implementation
# File lib/lignite/rbf_declarer.rb, line 42 def add(name) seen = @object_names[name] unless seen.nil? raise "Name #{name.inspect} already declared with index #{seen}" end @counter += 1 @object_names[name] = @counter end