Commit 6094ac85 authored by Xavier Thompson's avatar Xavier Thompson

Reorganise cypclass wrapper injection code

parent 341223c4
This diff is collapsed.
...@@ -141,7 +141,7 @@ def inject_utility_code_stage_factory(context): ...@@ -141,7 +141,7 @@ def inject_utility_code_stage_factory(context):
def create_pipeline(context, mode, exclude_classes=()): def create_pipeline(context, mode, exclude_classes=()):
assert mode in ('pyx', 'py', 'pxd') assert mode in ('pyx', 'py', 'pxd')
from .Visitor import PrintTree from .Visitor import PrintTree
from .CypclassWrapper import CypclassWrapperInjection from .CypclassTransforms import CypclassWrapperInjection
from .ParseTreeTransforms import WithTransform, NormalizeTree, PostParse, PxdPostParse from .ParseTreeTransforms import WithTransform, NormalizeTree, PostParse, PxdPostParse
from .ParseTreeTransforms import ForwardDeclareTypes, InjectGilHandling, AnalyseDeclarationsTransform from .ParseTreeTransforms import ForwardDeclareTypes, InjectGilHandling, AnalyseDeclarationsTransform
from .ParseTreeTransforms import AnalyseExpressionsTransform, FindInvalidUseOfFusedTypes from .ParseTreeTransforms import AnalyseExpressionsTransform, FindInvalidUseOfFusedTypes
......
...@@ -513,6 +513,18 @@ class Scope(object): ...@@ -513,6 +513,18 @@ class Scope(object):
for scope in sorted(self.subscopes, key=operator.attrgetter('scope_prefix')): for scope in sorted(self.subscopes, key=operator.attrgetter('scope_prefix')):
yield scope yield scope
def iter_cypclass_entries_and_scopes(self):
"""
Recursively iterate over nested cypclasses and their associated scope
"""
for entry in self.cypclass_entries:
cypclass_scope = entry.type.scope
yield entry, cypclass_scope
if cypclass_scope:
for e, s in cypclass_scope.iter_cypclass_entries_and_scopes():
yield e, s
def declare_tracked(self, entry): def declare_tracked(self, entry):
# Keying only with the name is wrong: if we have multiple attributes # Keying only with the name is wrong: if we have multiple attributes
# with the same name in different cypclass, this will conflict. # with the same name in different cypclass, this will conflict.
......
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