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 b0cb74423d
commit 26059208ff

View File

@ -2132,23 +2132,26 @@ impl TopLevelComposer {
else { else {
unreachable!() unreachable!()
}; };
// do this only if destination differs from current instance_to_symbol.insert(String::new(), simple_name.to_string());
if let Some(dest) == /* also extract destination from the decorator ... */
{
instance_to_symbol.insert(String::new(), simple_name.to_string());
}
continue; continue;
} }
if !decorator_list.is_empty() if let ExprKind::Call { func, keywords, .. } = &decorator_list[0].node {
&& matches!(&decorator_list[0].node, if matches!(&func.node, ExprKind::Name { id, .. } if id == &"subkernel".into())
ast::ExprKind::Name{ id, .. } if id == &"subkernel".into())
{ {
// do this only if destination differs from current let subkernel_dest = keywords.iter().find(|keyword| {
if let Some(dest) == /* also extract destination from the decorator ... */ if keyword.node.arg == Some("destination".into()) {
{ if let ExprKind::Constant { value, .. } = &keyword.node.value.node {
instance_to_symbol.insert(String::new(), simple_name.to_string()); 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; continue;
} }