Merge pull request #5184 from youknowone/symboltable

better symboltable error message
This commit is contained in:
Jeong, YunWon authored and GitHub committed 2024-02-29 22:19:46 +09:00
commit d0c827ed38
1 file changed
+2 -2
+2 -2
View File
@@ -478,8 +478,8 @@ impl Compiler {
self.check_forbidden_name(&name, usage)?;
let symbol_table = self.symbol_table_stack.last().unwrap();
let symbol = symbol_table.lookup(name.as_ref()).expect(
"The symbol must be present in the symbol table, even when it is undefined in python.",
let symbol = symbol_table.lookup(name.as_ref()).unwrap_or_else(||
panic!("The symbol '{name}' must be present in the symbol table, even when it is undefined in python."),
);
let info = self.code_stack.last_mut().unwrap();
let mut cache = &mut info.name_cache;