From 5574b575eb09d8121d870fbabe46e7606e6c81eb Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 5 Apr 2021 15:52:55 -0600 Subject: skip if any conditional is skipping, not just innermost --- src/makefile/conditional.rs | 3 +++ src/makefile/input.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/makefile/conditional.rs b/src/makefile/conditional.rs index 4490e8c..989dfc9 100644 --- a/src/makefile/conditional.rs +++ b/src/makefile/conditional.rs @@ -2,6 +2,7 @@ use eyre::{bail, Result}; use super::token::TokenString; +#[derive(Debug)] pub enum Line { /// spelled "ifeq" IfEqual(TokenString, TokenString), @@ -19,6 +20,7 @@ pub enum Line { EndIf, } +#[derive(Debug)] pub enum State { /// we saw a conditional, the condition was true, we're executing now /// and if we hit an else we will start SkippingUntilEndIf @@ -42,6 +44,7 @@ impl State { } } +#[derive(Debug)] pub enum StateAction { Push(State), Replace(State), diff --git a/src/makefile/input.rs b/src/makefile/input.rs index d90378d..5dfaed7 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -373,8 +373,8 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { // skip lines if we need to if self .conditional_stack - .last() - .map_or(false, ConditionalState::skipping) + .iter() + .any(ConditionalState::skipping) { continue; } -- cgit v1.2.3