From f50b765c1e98c7100b0171bc4dadaca4b9376afd Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 9 Aug 2024 20:24:18 -0400 Subject: [PATCH] Clean up --- dust-lang/src/analyzer.rs | 8 +++++--- dust-lang/src/parse.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dust-lang/src/analyzer.rs b/dust-lang/src/analyzer.rs index 4e3a7b7..56b56e3 100644 --- a/dust-lang/src/analyzer.rs +++ b/dust-lang/src/analyzer.rs @@ -82,15 +82,17 @@ impl<'a> Analyzer<'a> { operator, right, } => { - self.analyze_node(left)?; - self.analyze_node(right)?; - if let BinaryOperator::AddAssign | BinaryOperator::Assign = operator.inner { if let Statement::Identifier(_) = left.inner { + self.analyze_node(right)?; + return Ok(()); } } + self.analyze_node(left)?; + self.analyze_node(right)?; + let left_type = left.inner.expected_type(self.variables); let right_type = right.inner.expected_type(self.variables); diff --git a/dust-lang/src/parse.rs b/dust-lang/src/parse.rs index 348cd7d..38a2b1b 100644 --- a/dust-lang/src/parse.rs +++ b/dust-lang/src/parse.rs @@ -272,8 +272,8 @@ impl<'src> Parser<'src> { // Add the new property to the map map_properties.push((*left, *right)); } - // Otherwise, the new statement is a block } + // Otherwise, the new statement is a block } else if let Statement::Block(statements) = statement.get_or_insert_with(|| Statement::Block(Vec::new())) {