Sha256: ab03d16afba10ec66c578c25d2297e04310d38cc065f93111d89df5c79fc8863
Contents?: true
Size: 446 Bytes
Versions: 3
Compression:
Stored size: 446 Bytes
Contents
module Lignite # Allocate local or global variables class Variables def initialize @offset = 0 @vars = {} end def add(id, size) raise "Duplicate variable #{id}" if @vars.key?(id) @vars[id] = {offset: @offset, size: size} @offset += size end def bytesize @offset end def key?(sym) @vars.key?(sym) end def offset(sym) @vars[sym][:offset] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lignite-0.1.2 | lib/lignite/variables.rb |
lignite-0.1.1 | lib/lignite/variables.rb |
lignite-0.1.0 | lib/lignite/variables.rb |