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())) {