1
0
forked from M-Labs/nac3

composer: handle external subkernels

This commit is contained in:
mwojcik 2024-11-01 13:41:08 +08:00
parent 1566f67917
commit 660bfeae85

View File

@ -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;
}