This commit is contained in:
Jeff 2024-08-09 20:24:18 -04:00
parent 82fbf796f3
commit f50b765c1e
2 changed files with 6 additions and 4 deletions

View File

@ -82,15 +82,17 @@ impl<'a> Analyzer<'a> {
operator, operator,
right, right,
} => { } => {
self.analyze_node(left)?;
self.analyze_node(right)?;
if let BinaryOperator::AddAssign | BinaryOperator::Assign = operator.inner { if let BinaryOperator::AddAssign | BinaryOperator::Assign = operator.inner {
if let Statement::Identifier(_) = left.inner { if let Statement::Identifier(_) = left.inner {
self.analyze_node(right)?;
return Ok(()); return Ok(());
} }
} }
self.analyze_node(left)?;
self.analyze_node(right)?;
let left_type = left.inner.expected_type(self.variables); let left_type = left.inner.expected_type(self.variables);
let right_type = right.inner.expected_type(self.variables); let right_type = right.inner.expected_type(self.variables);

View File

@ -272,8 +272,8 @@ impl<'src> Parser<'src> {
// Add the new property to the map // Add the new property to the map
map_properties.push((*left, *right)); 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) = } else if let Statement::Block(statements) =
statement.get_or_insert_with(|| Statement::Block(Vec::new())) statement.get_or_insert_with(|| Statement::Block(Vec::new()))
{ {