Term* find_or_create_state_input(Branch* branch) { // check if there is already a stateful input Term* existing = find_state_input(branch); if (existing != NULL) return existing; // None yet, insert one Term* input = append_state_input(branch); // Add a final pack_state call too append_final_pack_state(branch); return input; }
Term* find_or_create_state_container(Branch* branch) { Term* existing = find_active_state_container(branch); if (existing != NULL) return existing; // None yet, insert one Term* input = append_state_input(branch); // Add a final pack_state call too Term* packState = append_final_pack_state(branch); // And the state output append_state_output(branch); return input; }