Convert CTypeDefNode to use explicit visibilities.
authorW. Trevor King <wking@drexel.edu>
Thu, 3 Mar 2011 13:28:17 +0000 (08:28 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 3 Mar 2011 13:28:17 +0000 (08:28 -0500)
Cython/Compiler/Nodes.py
Cython/Compiler/Parsing.py

index edd0f4dba3c61073a4917d02d89bbc1bd70e08de..b4730bc0def78d7b3f84b23ec4b948d8af60ae95 100644 (file)
@@ -1157,10 +1157,12 @@ class CTypeDefNode(StatNode):
     def analyse_declarations(self, env):
         base = self.base_type.analyse(env)
         name_declarator, type = self.declarator.analyse(base, env)
-        name = name_declarator.name
-        cname = name_declarator.cname
-        entry = env.declare_typedef(name, type, self.pos,
-            cname = cname, visibility = self.visibility)
+        binding = Binding()
+        binding.pull(self)
+        binding.name = name_declarator.name
+        binding.cname = name_declarator.cname
+        entry = env.WTK_declare_typedef(
+            binding, base_type = type, pos = self.pos)
         if self.in_pxd and not env.in_cinclude:
             entry.defined_in_pxd = 1
 
index a8967d9141d5250c10fe3222480c1bf41b1cdfe5..c969dbe266803e373f9acf6e52121fe9086a00af 100644 (file)
@@ -2775,14 +2775,10 @@ def p_ctypedef_statement(s, pos, ctx):
             s.error("Syntax error in ctypedef statement")
         declarator = p_c_declarator(s, ctx, is_type = 1, nonempty = 1)
         s.expect_newline("Syntax error in ctypedef statement")
-        visibility = 'private'
-        if ctx.extern:
-            visibility = 'extern'
-        elif ctx.c_visibility != 'private':
-            visibility = ctx.c_visibility
         return Nodes.CTypeDefNode(
-            pos, base_type = base_type,
-            declarator = declarator, visibility = visibility,
+            pos, base_type = base_type, declarator = declarator,
+            extern = ctx.extern, visibility = ctx.visibility,
+            c_visibility = ctx.c_visibility,
             in_pxd = ctx.level == 'module_pxd')
 
 def p_decorators(s):