Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Kumshayev committed Jul 21, 2024
1 parent 4dd7ecb commit ae8574c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions macros/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,6 @@ pub fn generate_code(sm: &ParsedStateMachine) -> proc_macro2::TokenStream {
let entry_ident = format_ident!("on_entry_{}", string_morph::to_snake_case(out_state_string));
let exit_ident = format_ident!("on_exit_{}", string_morph::to_snake_case(in_state_string));

let on_exit = quote!{self.context.#exit_ident();};
let on_entry = quote!{ self.context.#entry_ident(); };

let (is_async_action, action_code) = generate_action(action, &temporary_context_call, action_params, &error_type_name);
is_async_state_machine |= is_async_action;

Expand All @@ -434,16 +431,15 @@ pub fn generate_code(sm: &ParsedStateMachine) -> proc_macro2::TokenStream {
self.state = #states_type_name::#out_state;
return Ok(&self.state);
}

} else {
quote!{
#on_exit
self.context.#exit_ident();
#action_code
let out_state = #states_type_name::#out_state;
self.context.log_state_change(&out_state);
self.context().transition_callback(&self.state, &out_state);
self.state = out_state;
#on_entry
self.context.#entry_ident();
return Ok(&self.state);
}
};
Expand Down

0 comments on commit ae8574c

Please sign in to comment.