diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index eaf4457a..5e86cb38 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -2132,23 +2132,26 @@ impl TopLevelComposer { else { unreachable!() }; - // do this only if destination differs from current - if let Some(dest) == /* also extract destination from the decorator ... */ - { - instance_to_symbol.insert(String::new(), simple_name.to_string()); - } + instance_to_symbol.insert(String::new(), simple_name.to_string()); continue; } - if !decorator_list.is_empty() - && matches!(&decorator_list[0].node, - ast::ExprKind::Name{ id, .. } if id == &"subkernel".into()) + if let ExprKind::Call { func, keywords, .. } = &decorator_list[0].node { + if matches!(&func.node, ExprKind::Name { id, .. } if id == &"subkernel".into()) { - // do this only if destination differs from current - if let Some(dest) == /* also extract destination from the decorator ... */ - { - instance_to_symbol.insert(String::new(), simple_name.to_string()); + let subkernel_dest = keywords.iter().find(|keyword| { + if keyword.node.arg == Some("destination".into()) { + if let ExprKind::Constant { value, .. } = &keyword.node.value.node { + return true; + } + } + false + } + ).node.value.node.value; + if let Some(Constant::Int(sk_dest)) == subkernel_dest { + if sk_dest != destination.unwrap_or(0) { + instance_to_symbol.insert(String::new(), simple_name.to_string()); + } } - continue; }