From b52b017c37afd020270704f13eaaf0abc80bf7dd Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Sun, 19 Jan 2025 15:04:31 +0900 Subject: [PATCH] fix: decl file generation bug --- crates/py2erg/gen_decl.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/crates/py2erg/gen_decl.rs b/crates/py2erg/gen_decl.rs index 705536c..d9743e0 100644 --- a/crates/py2erg/gen_decl.rs +++ b/crates/py2erg/gen_decl.rs @@ -7,6 +7,7 @@ use erg_common::set::Set; use erg_common::traits::LimitedDisplay; use erg_common::{log, Str}; use erg_compiler::build_package::{CheckStatus, PylyzerStatus}; +use erg_compiler::context::ControlKind; use erg_compiler::hir::{ClassDef, Expr, HIR}; use erg_compiler::module::SharedModuleCache; use erg_compiler::ty::value::{GenTypeObj, TypeObj}; @@ -182,6 +183,26 @@ impl DeclFileGenerator { self.gen_chunk_decl(chunk); } } + Expr::Compound(compound) => { + for chunk in compound.iter() { + self.gen_chunk_decl(chunk); + } + } + Expr::Call(call) + if call + .obj + .show_acc() + .is_some_and(|acc| ControlKind::try_from(&acc[..]).is_ok()) => + { + for arg in call.args.iter() { + self.gen_chunk_decl(arg); + } + } + Expr::Lambda(lambda) => { + for arg in lambda.body.iter() { + self.gen_chunk_decl(arg); + } + } _ => {} } self.code.push('\n');