Normalize WTK_declare_builtin -> declare_builtin.
authorW. Trevor King <wking@drexel.edu>
Fri, 4 Mar 2011 03:27:28 +0000 (22:27 -0500)
committerW. Trevor King <wking@drexel.edu>
Fri, 4 Mar 2011 03:27:28 +0000 (22:27 -0500)
Cython/Compiler/ExprNodes.py
Cython/Compiler/Symtab.py

index c965251024ea01428193ad5cc3c563a2a6ea793a..75c9266002051a1f3e243304a957a6384017be58 100755 (executable)
@@ -16,6 +16,7 @@ import operator
 
 from Errors import error, warning, warn_once, InternalError, CompileError
 from Errors import hold_errors, release_errors, held_errors, report_error
+from Binding import Binding
 from Code import UtilityCode
 import StringEncoding
 import Naming
@@ -1335,7 +1336,9 @@ class NameNode(AtomicExprNode):
                 var_entry = entry.as_variable
                 if var_entry:
                     if var_entry.is_builtin and Options.cache_builtins:
-                        var_entry = env.declare_builtin(var_entry.name, self.pos)
+                        binding = Binding(name = var_entry.name)
+                        var_entry = env.declare_builtin(
+                            binding, pos = self.pos)
                     node = NameNode(self.pos, name = self.name)
                     node.entry = var_entry
                     node.analyse_rvalue_entry(env)
@@ -1398,7 +1401,8 @@ class NameNode(AtomicExprNode):
         if self.entry is None:
             self.entry = env.lookup(self.name)
         if not self.entry:
-            self.entry = env.declare_builtin(self.name, self.pos)
+            binding = Binding(name = self.name)
+            self.entry = env.declare_builtin(binding, pos = self.pos)
         if not self.entry:
             self.type = PyrexTypes.error_type
             return
index 90ecaa0c7847711a25de276d338d7c1ffdbfa84d..1e2947c6a172c65643c567519e854d5a70875978 100644 (file)
@@ -594,12 +594,8 @@ class Scope(object):
             (), (binding.name, 'initialized'), False)
         return entry
 
-    def declare_builtin(self, name, pos):
-        binding = self._WTK_setup(name, name, visibility='private')
-        return self.WTK_declare_builtin(binding, pos)
-
-    def WTK_declare_builtin(self, binding, pos):
-        return self.outer_scope.WTK_declare_builtin(binding, pos)
+    def declare_builtin(self, binding, pos):
+        return self.outer_scope.declare_builtin(binding, pos = pos)
 
     def _declare_pyfunction(self, binding, entry = None, pos = None):
         if entry and not entry.type.is_cfunction:
@@ -820,11 +816,7 @@ class PreImportScope(Scope):
     def __init__(self):
         Scope.__init__(self, Options.pre_import, None, None)
 
-    def declare_builtin(self, name, pos):
-        binding = self._WTK_setup(name, name, visibility='private')
-        return self.WTK_declare_builtin(binding, pos)
-
-    def WTK_declare_builtin(self, binding, pos):
+    def declare_builtin(self, binding, pos):
         entry = self.WTK_declare(binding, py_object_type, pos = pos)
         entry.is_variable = True
         entry.is_pyglobal = True
@@ -853,15 +845,10 @@ class BuiltinScope(Scope):
                 name = 'unicode'
         return Scope.lookup(self, name)
 
-    def declare_builtin(self, name, pos):
-        binding = self._WTK_setup(name, name, visibility='private')
-        return self.WTK_declare_builtin(binding, pos)
-
-    def WTK_declare_builtin(self, binding, pos):
+    def declare_builtin(self, binding, pos):
         if not hasattr(builtins, binding.name):
             if self.outer_scope is not None:
-                return self.outer_scope.WTK_declare_builtin(
-                    binding, pos=pos)
+                return self.outer_scope.declare_builtin(binding, pos = pos)
             else:
                 error(pos, "undeclared name not builtin: %s" %
                       binding.name)
@@ -1028,12 +1015,7 @@ class ModuleScope(Scope):
             return entry
         return self.outer_scope.lookup(name, language_level = self.context.language_level)
 
-    def declare_builtin(self, name, pos):
-        binding = self._WTK_setup(name, name, visibility='private')
-        # python visibility?
-        return self.WTK_declare_builtin(binding, pos)
-
-    def WTK_declare_builtin(self, binding, pos):
+    def declare_builtin(self, binding, pos):
         if (not hasattr(builtins, binding.name)
             and binding.name != 'xrange'):
             # 'xrange' is special cased in Code.py
@@ -1042,8 +1024,7 @@ class ModuleScope(Scope):
                     binding, py_object_type, pos = pos)
                 return entry
             elif self.outer_scope is not None:
-                return self.outer_scope.WTK_declare_builtin(
-                    binding, pos)
+                return self.outer_scope.declare_builtin(binding, pos = pos)
             else:
                 error(pos, "undeclared name not builtin: %s" %
                       binding.name)