Skip to content

Commit

Permalink
Uhm.. For some reason I thought class-ivars were not working properly…
Browse files Browse the repository at this point in the history
… for Symbol, but when trying to write a test to fix it, it turned out to work, so this cleans up Symbol accordingly
  • Loading branch information
vidarh committed Jun 4, 2015
1 parent 9abb565 commit 077dcf3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/core/symbol.rb
Expand Up @@ -14,11 +14,7 @@
# use to return the same object for the same symbol literal

class Symbol
# FIXME:
# Both class variables and class instance variables are currently not
# working properly, so for now we store the hash of the already allocated
# symbols in a constant:
SymHash = {}
@symbols = {}

# FIXME: Should be private, but we don't support that yet
def initialize(name)
Expand All @@ -38,10 +34,10 @@ def hash
# Alternatively, the compiler can do this _once_ at the start for
# any symbol encountered in the source text, and store the result.
def self.__get_symbol(name)
sym = SymHash[name]
sym = @symbols[name]
if sym.nil? ## FIXME: Doing !sym instead fails w/method missing
sym = Symbol.new(name)
SymHash[name] = sym
@symbols[name] = sym
end
sym
end
Expand Down

0 comments on commit 077dcf3

Please sign in to comment.