lib/nydp/symbol_lookup.rb in nydp-0.2.3 vs lib/nydp/symbol_lookup.rb in nydp-0.2.5

- old
+ new

@@ -2,19 +2,27 @@ module Nydp class SymbolLookup extend Helper + def self.skip_empty bindings + while Nydp::NIL.isnt?(bindings) && bindings.car.empty? + bindings = bindings.cdr + end + bindings + end + def self.build name, bindings + bindings = skip_empty bindings depth = 0 while Nydp::NIL.isnt? bindings here = bindings.car if here.key? name binding_index = here[name] return ContextSymbol.build(depth, name, binding_index) else depth += 1 - bindings = bindings.cdr + bindings = skip_empty bindings.cdr end end name end end