diff --git a/src/aml/mod.rs b/src/aml/mod.rs index 55064439..b013a195 100644 --- a/src/aml/mod.rs +++ b/src/aml/mod.rs @@ -2865,7 +2865,8 @@ where } else { loop { let Some(block) = context.block_stack.pop() else { Err(AmlError::ContinueOutsideOfWhile)? }; - if let BlockKind::While { start_pc, start_nanos } = block.kind { + context.current_block = block; + if let BlockKind::While { start_pc, start_nanos } = context.current_block.kind { context.current_block.pc = start_pc; start = start_nanos; break; diff --git a/tests/while.asl b/tests/while.asl index e6b4a9b6..bfd7082c 100644 --- a/tests/while.asl +++ b/tests/while.asl @@ -51,11 +51,33 @@ DefinitionBlock("while.aml", "DSDT", 1, "RSACPI", "WHILE", 1) { CHEK(Local0, 0) } + Method(T5) { + // Test `Continue` from within an If block (adapted from uACPI's `while-continue.asl`) + Local0 = 1 + Local1 = 10 + + While (Local0) { + If (Local1--) { + Debug = "Incrementing Local0 & continuing" + Local0++ + Debug = Local0 + Continue + } + + Debug = "Local1 is 0, breaking" + Break + } + + CHEK(Local0, 10) + CHEK(Local1, 0) + } + Method(MAIN) { T1() T2() T3() T4() + T5() Return(FCNT) }