Merge pull request #4226 from jopemachine/fix-class-static

Fix lambda expression's  unexpected `UnboundLocalError`
This commit is contained in:
Jeong YunWon 2022-10-17 13:46:09 +09:00 committed by GitHub
commit 3768647eb0

View file

@ -2118,15 +2118,16 @@ impl Compiler {
Name { id, .. } => self.load_name(id)?,
Lambda { args, body } => {
let prev_ctx = self.ctx;
let name = "<lambda>".to_owned();
let mut funcflags = self.enter_function(&name, args)?;
self.ctx = CompileContext {
loop_data: Option::None,
in_class: prev_ctx.in_class,
func: FunctionContext::Function,
};
let name = "<lambda>".to_owned();
let mut funcflags = self.enter_function(&name, args)?;
self.current_codeinfo()
.constants
.insert_full(ConstantData::None);