From: W. Trevor King Date: Fri, 4 Mar 2011 03:27:28 +0000 (-0500) Subject: Normalize WTK_declare_builtin -> declare_builtin. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d6d51a83d9dc8602e366054056e11ff7f1ec2e69;p=cython.git Normalize WTK_declare_builtin -> declare_builtin. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index c9652510..75c92660 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -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 diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index 90ecaa0c..1e2947c6 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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)