Cleanup weird locals in codegen

This commit is contained in:
Emil Fresk 2023-01-07 14:13:18 +01:00 committed by Henrik Tjäder
parent c6fca67ae2
commit 2ce382fddd

View file

@ -27,10 +27,6 @@ mod main;
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 { pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 {
let mut mod_app = vec![];
let mut root = vec![];
let mut user = vec![];
// Generate the `main` function // Generate the `main` function
let main = main::codegen(app, analysis); let main = main::codegen(app, analysis);
@ -38,24 +34,6 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 {
let (mod_app_idle, root_idle, user_idle) = idle::codegen(app, analysis); let (mod_app_idle, root_idle, user_idle) = idle::codegen(app, analysis);
user.push(quote!(
#user_init
#user_idle
));
root.push(quote!(
#(#root_init)*
#(#root_idle)*
));
mod_app.push(quote!(
#mod_app_init
#(#mod_app_idle)*
));
let (mod_app_shared_resources, mod_shared_resources) = shared_resources::codegen(app, analysis); let (mod_app_shared_resources, mod_shared_resources) = shared_resources::codegen(app, analysis);
let (mod_app_local_resources, mod_local_resources) = local_resources::codegen(app, analysis); let (mod_app_local_resources, mod_local_resources) = local_resources::codegen(app, analysis);
@ -85,13 +63,21 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 {
#(#user_code)* #(#user_code)*
/// User code end /// User code end
#(#user)*
#(#user_hardware_tasks)* #(#user_hardware_tasks)*
#(#user_software_tasks)* #(#user_software_tasks)*
#(#root)* #mod_app_init
#(#root_init)*
#user_init
#(#mod_app_idle)*
#(#root_idle)*
#user_idle
#mod_shared_resources #mod_shared_resources
@ -101,9 +87,6 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 {
#(#root_software_tasks)* #(#root_software_tasks)*
/// app module
#(#mod_app)*
#(#mod_app_shared_resources)* #(#mod_app_shared_resources)*
#(#mod_app_local_resources)* #(#mod_app_local_resources)*