From: W. Trevor King Date: Sun, 6 Mar 2011 03:04:15 +0000 (-0500) Subject: Normalize WTK_declare_struct_or_union -> declare_struct_or_union. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=963f692c9979ebfe4c4fc5bb5095fc83d1a91c11;p=cython.git Normalize WTK_declare_struct_or_union -> declare_struct_or_union. --- diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index 34273c40..94561920 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -570,8 +570,9 @@ def init_builtin_structs(): for attribute_name, attribute_type in attribute_types: scope.declare_var(attribute_name, attribute_type, None, attribute_name, allow_pyobject=True) + binding = Binding(name = name, cname = cname) builtin_scope.declare_struct_or_union( - name, "struct", scope, 1, None, cname = cname) + binding, kind = 'struct', scope = scope, typedef_flag = True) def init_builtins(): init_builtin_structs() diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 04f570b3..eee0037d 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -567,12 +567,9 @@ class CFuncDeclaratorNode(CDeclaratorNode): for arg in func_type_args[len(func_type_args)-self.optional_arg_count:]: scope.declare_var(arg.name, arg.type, arg.pos, allow_pyobject = 1) struct_cname = env.mangle(Naming.opt_arg_prefix, self.base.name) - self.op_args_struct = env.global_scope().declare_struct_or_union(name = struct_cname, - kind = 'struct', - scope = scope, - typedef_flag = 0, - pos = self.pos, - cname = struct_cname) + binding = Binding(name = struct_cname, cname = struct_cname) + self.op_args_struct = env.global_scope().declare_struct_or_union( + binding, kind = 'struct', scope = scope, pos = self.pos) self.op_args_struct.defined_in_pxd = 1 self.op_args_struct.used = 1 @@ -1000,7 +997,7 @@ class CStructOrUnionDefNode(StatNode): scope = StructOrUnionScope(self.name) binding = Binding() binding.pull(self) - self.entry = env.WTK_declare_struct_or_union( + self.entry = env.declare_struct_or_union( binding, kind = self.kind, scope = scope, typedef_flag = self.typedef_flag, packed = self.packed, pos = self.pos) @@ -3519,7 +3516,10 @@ class SingleAssignmentNode(AssignmentNode): error(self.lhs.pos, "Invalid declaration.") name = self.lhs.name scope = StructOrUnionScope(name) - env.declare_struct_or_union(name, func_name, scope, False, self.rhs.pos) + binding = Binding(name = name) + env.declare_struct_or_union( + binding, kind = func_name, scope = scope, + pos = self.rhs.pos) for member, type, pos in members: scope.declare_var(member, type, pos) @@ -5280,8 +5280,9 @@ class FromCImportStatNode(StatNode): entry.redeclared(pos) else: if kind == 'struct' or kind == 'union': - entry = module_scope.declare_struct_or_union(name, - kind = kind, scope = None, typedef_flag = 0, pos = pos) + binding = Binding(name = name) + entry = module_scope.declare_struct_or_union( + binding, kind = kind, scope = None, pos = pos) elif kind == 'class': entry = module_scope.declare_c_class(name, pos = pos, module_name = self.module_name) diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 19bbeaa0..5448bf00 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -435,15 +435,8 @@ class Scope(object): type.qualified_name = entry.qualified_name return entry - def declare_struct_or_union(self, name, kind, scope, - typedef_flag, pos, cname = None, visibility = 'private', - packed = False): - binding = self._WTK_setup(name, cname, visibility=visibility) - return self.WTK_declare_struct_or_union(binding, pos, kind, scope, typedef_flag, packed) - - def WTK_declare_struct_or_union( - self, binding, - pos, kind, scope, typedef_flag, packed=False): + def declare_struct_or_union(self, binding, kind, scope, typedef_flag=False, + packed=False, pos = None): # Add an entry for a struct or union definition. if not binding.cname: if self.in_cinclude or binding.c_visibility == 'public':