1. scope
  2. hob


Jan Borsodi  committed d755a41

A symbol object can now point to another symbol, it will iteratively resolve symbols until it reaches the actual object. The resolved object is placed in the symbol as the attribute 'resolved'.

  • Participants
  • Parent commits 8d1404d
  • Branches fixes

Comments (0)

Files changed (1)

File hob/parser.py

View file
  • Ignore whitespace
     def _resolveSymbols(self):
         for sym in self._symbols:
-            item = self.package.find(sym.name, sym.current)
+            current = sym.current
+            while isinstance(current, Symbol):
+                current = current.resolved
+            item = self.package.find(sym.name, current)
+            sym.resolved = item
             if not isinstance(item, sym.kind):
-                raise TypeError("Expected type %s for symbol %s" % (sym.kind.__name__, ".".join(sym.current.path() + [sym.name])))
+                raise TypeError("Expected type %s for symbol %s" % (sym.kind.__name__, ".".join(current.path() + [sym.name])))
             setattr(sym.owner, sym.attribute, item)
             if sym.callback:
                 sym.callback(sym, item)