Commit c72687b6 authored by Stefan Behnel's avatar Stefan Behnel

minor code cleanup

parent b8baa94d
...@@ -1617,8 +1617,9 @@ class CreateClosureClasses(CythonTransform): ...@@ -1617,8 +1617,9 @@ class CreateClosureClasses(CythonTransform):
inner_node.needs_self_code = False inner_node.needs_self_code = False
node.needs_outer_scope = False node.needs_outer_scope = False
base_type = None
if node.is_generator: if node.is_generator:
generator_class = self.create_generator_class(target_module_scope, node.pos) base_type = self.create_generator_class(target_module_scope, node.pos)
elif not in_closure and not from_closure: elif not in_closure and not from_closure:
return return
elif not in_closure: elif not in_closure:
...@@ -1629,12 +1630,10 @@ class CreateClosureClasses(CythonTransform): ...@@ -1629,12 +1630,10 @@ class CreateClosureClasses(CythonTransform):
as_name = '%s_%s' % (target_module_scope.next_id(Naming.closure_class_prefix), node.entry.cname) as_name = '%s_%s' % (target_module_scope.next_id(Naming.closure_class_prefix), node.entry.cname)
if node.is_generator: entry = target_module_scope.declare_c_class(
entry = target_module_scope.declare_c_class(name = as_name, name=as_name, pos=node.pos, defining=True,
pos = node.pos, defining = True, implementing = True, base_type=generator_class) implementing=True, base_type=base_type)
else:
entry = target_module_scope.declare_c_class(name = as_name,
pos = node.pos, defining = True, implementing = True)
func_scope.scope_class = entry func_scope.scope_class = entry
class_scope = entry.type.scope class_scope = entry.type.scope
class_scope.is_internal = True class_scope.is_internal = True
......
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