From b9b3ded5e21c40256163cf85f4fba2991c03a45c Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Sat, 7 Jan 2023 14:13:18 +0100 Subject: [PATCH] Cleanup weird locals in codegen --- macros/src/codegen.rs | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 839b1cd401..bb1028f764 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -27,10 +27,6 @@ mod main; #[allow(clippy::too_many_lines)] 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 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); - 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_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 end - #(#user)* - #(#user_hardware_tasks)* #(#user_software_tasks)* - #(#root)* + #mod_app_init + + #(#root_init)* + + #user_init + + #(#mod_app_idle)* + + #(#root_idle)* + + #user_idle #mod_shared_resources @@ -101,9 +87,6 @@ pub fn app(app: &App, analysis: &Analysis) -> TokenStream2 { #(#root_software_tasks)* - /// app module - #(#mod_app)* - #(#mod_app_shared_resources)* #(#mod_app_local_resources)*