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
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)
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
(), (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:
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
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)
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
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)