mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-30 07:08:14 +00:00
Always load __debug__ as a const.
This commit is contained in:
parent
8b9f57906a
commit
ce5cdd1bcb
1 changed files with 8 additions and 0 deletions
|
@ -500,6 +500,14 @@ impl Compiler {
|
||||||
// // TODO: is this right?
|
// // TODO: is this right?
|
||||||
// SymbolScope::Unknown => NameOpType::Global,
|
// SymbolScope::Unknown => NameOpType::Global,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if NameUsage::Load == usage && name == "__debug__" {
|
||||||
|
self.emit_constant(ConstantData::Boolean {
|
||||||
|
value: self.opts.optimize == 0,
|
||||||
|
});
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut idx = cache
|
let mut idx = cache
|
||||||
.get_index_of(name.as_ref())
|
.get_index_of(name.as_ref())
|
||||||
.unwrap_or_else(|| cache.insert_full(name.into_owned()).0);
|
.unwrap_or_else(|| cache.insert_full(name.into_owned()).0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue