if entry and entry.is_cfunction:
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)
node = NameNode(self.pos, name = self.name)
node.entry = var_entry
node.analyse_rvalue_entry(env)
return self.outer_scope.declare_builtin(name, pos)
else:
error(pos, "undeclared name not builtin: %s"%name)
- entry = self.declare(name, name, py_object_type, pos)
+ if Options.cache_builtins:
+ for entry in self.cached_builtins:
+ if entry.name == name:
+ return entry
+ entry = self.declare(None, None, py_object_type, pos)
if Options.cache_builtins:
entry.is_builtin = 1
entry.is_const = 1
+ entry.name = name
entry.cname = Naming.builtin_prefix + name
self.cached_builtins.append(entry)
self.undeclared_cached_builtins.append(entry)