From 06714ae5a7e0bb4adcb093fda7fe220c677913f3 Mon Sep 17 00:00:00 2001 From: "Vasquez Alfaro, Juan J" Date: Fri, 22 Aug 2025 15:27:49 -0600 Subject: [PATCH] Compensate depth for compound blocks inside HashIf content --- src/analysis/parsing/statement.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/analysis/parsing/statement.rs b/src/analysis/parsing/statement.rs index a02401e..bb624a7 100644 --- a/src/analysis/parsing/statement.rs +++ b/src/analysis/parsing/statement.rs @@ -496,6 +496,17 @@ impl TreeElement for HashIfContent { &self.truebranch, &self.elsebranch) } + fn style_check(&self, acc: &mut Vec, rules: &CurrentRules, mut aux: AuxParams) { + self.evaluate_rules(acc, rules, aux); + self.cond.style_check(acc, rules, aux); + + if let Content::Some(statement::StatementContent::Compound(_)) + = self.truebranch.content.as_ref() { + aux.depth -= 1; + } + self.truebranch.style_check(acc, rules, aux); + self.elsebranch.style_check(acc, rules, aux); + } } impl Parse for HashIfContent {