Commit 056bf494 authored by Xavier Thompson's avatar Xavier Thompson

Cache const-or-volatile-propagated entries from scope of const or volatile object"

parent 0be3c6cc
...@@ -3246,13 +3246,18 @@ class CConstOrVolatileScope(Scope): ...@@ -3246,13 +3246,18 @@ class CConstOrVolatileScope(Scope):
self.base_type_scope = base_type_scope self.base_type_scope = base_type_scope
self.is_const = is_const self.is_const = is_const
self.is_volatile = is_volatile self.is_volatile = is_volatile
self.cached_const_or_volatile_entries = {}
def lookup_here(self, name): def lookup_here(self, name):
entry = self.base_type_scope.lookup_here(name) try:
if entry is not None: return self.cached_const_or_volatile_entries[name]
entry = copy.copy(entry) except KeyError:
entry.type = PyrexTypes.c_const_or_volatile_type( entry = self.base_type_scope.lookup_here(name)
entry.type, self.is_const, self.is_volatile) if entry is not None:
entry = copy.copy(entry)
entry.type = PyrexTypes.c_const_or_volatile_type(
entry.type, self.is_const, self.is_volatile)
self.cached_const_or_volatile_entries[name] = entry
return entry return entry
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment