Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#### Bug Fixes

- Reverted `InvokeKind::ProcRef` back to `InvokeKind::Exec` in `visit_mut_procref` and added an explanatory comment (#2893).
- Fixed `FastProcessor` so `after_exit` trace decorators execute when tracing is enabled without debug mode, and added a tracing-only regression test.
#### Changes

- Documented that enum variants are module-level constants and must be unique within a module (#2932).
Expand Down
2 changes: 1 addition & 1 deletion processor/src/fast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ impl FastProcessor {
current_forest: &MastForest,
host: &mut impl BaseHost,
) -> ControlFlow<BreakReason> {
if !self.in_debug_mode() {
if !self.should_execute_decorators() {
return ControlFlow::Continue(());
}

Expand Down
22 changes: 22 additions & 0 deletions processor/src/fast/tests/fast_decorator_execution_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ fn test_before_enter_decorator_executed_once_fast() {
assert_eq!(order[1].0, 2, "Second trace should be after_exit");
}

#[test]
fn test_after_exit_trace_executes_with_tracing_only_fast() {
let after_exit_decorator = Decorator::Trace(2);
let operations = [Operation::Noop];

let program = create_test_program(&[], &[after_exit_decorator], &operations);

let mut host = TestHost::new();
let processor = FastProcessor::new(StackInputs::default())
.with_advice(AdviceInputs::default())
.with_tracing(true);

let result = processor.execute_sync(&program, &mut host);
assert!(result.is_ok(), "Execution failed: {:?}", result);

assert_eq!(
host.get_trace_count(2),
1,
"after_exit trace decorator should execute when tracing is enabled without debug mode"
);
}

#[test]
fn test_multiple_before_enter_decorators_each_once_fast() {
let before_enter_decorators = [Decorator::Trace(1), Decorator::Trace(2), Decorator::Trace(3)];
Expand Down
Loading