From 02b2b37e396699c6179fc50241bbcc8216e90487 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 5 Mar 2011 22:08:48 -0500 Subject: [PATCH] Normalize WTK_declare_typedef -> declare_typedef. --- Cython/Compiler/CythonScope.py | 8 ++++---- Cython/Compiler/Nodes.py | 6 +++--- Cython/Compiler/Symtab.py | 7 +------ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Cython/Compiler/CythonScope.py b/Cython/Compiler/CythonScope.py index deffaffb..52f27d01 100644 --- a/Cython/Compiler/CythonScope.py +++ b/Cython/Compiler/CythonScope.py @@ -1,3 +1,4 @@ +from Binding import Binding from Symtab import ModuleScope from PyrexTypes import * @@ -32,10 +33,9 @@ def create_utility_scope(context): utility_scope = ModuleScope(u'utility', None, context) # These are used to optimize isinstance in FinalOptimizePhase - type_object = utility_scope.declare_typedef('PyTypeObject', - base_type = c_void_type, - pos = None, - cname = 'PyTypeObject') + binding = Binding(name = 'PyTypeObject', cname = 'PyTypeObject') + type_object = utility_scope.declare_typedef( + binding, base_type = c_void_type, pos = None) type_object.is_void = True utility_scope.declare_cfunction( diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index eee0037d..91fac61b 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1026,7 +1026,7 @@ class CStructOrUnionDefNode(StatNode): binding.pull(self) binding.c_visibility = 'ignore' binding.visibility = 'private' - self.entry = env.WTK_declare_typedef( + self.entry = env.declare_typedef( binding, base_type = struct_entry.type, pos = self.pos) struct_entry.type.typedef_flag = False # FIXME: this might be considered a hack ;-) @@ -1166,7 +1166,7 @@ class CTypeDefNode(StatNode): binding.pull(self) binding.name = name_declarator.name binding.cname = name_declarator.cname - entry = env.WTK_declare_typedef( + entry = env.declare_typedef( binding, base_type = type, pos = self.pos) if self.in_pxd and not env.in_cinclude: entry.defined_in_pxd = 1 @@ -3495,7 +3495,7 @@ class SingleAssignmentNode(AssignmentNode): binding = Binding( name = lhs.name, c_visibility='private', visibility='public') - env.WTK_declare_typedef( + env.declare_typedef( binding, base_type = type, pos = self.pos) elif func_name in ['struct', 'union']: diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 5448bf00..9843dc50 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -410,12 +410,7 @@ class Scope(object): # here we would set as_variable to an object representing this type return entry - def declare_typedef(self, name, base_type, pos, cname = None, - visibility = 'private'): - binding = self._WTK_setup(name, cname, visibility=visibility) - return self.WTK_declare_typedef(binding, base_type, pos) - - def WTK_declare_typedef(self, binding, + def declare_typedef(self, binding, base_type, pos): if not binding.cname: if self.in_cinclude or binding.c_visibility == 'public': -- 2.26.2