fix semantic analysis to allow assignment to indexed identifier
This commit is contained in:
parent
e0c3253ab6
commit
bd8270bd5d
|
@ -393,12 +393,22 @@ impl Assignment {
|
||||||
|
|
||||||
if let Some(variable_type) = variable_type {
|
if let Some(variable_type) = variable_type {
|
||||||
let expected = match variable_type {
|
let expected = match variable_type {
|
||||||
VariableType::BooleanStorage | VariableType::Tag => ValueType::Boolean,
|
VariableType::BooleanStorage => ValueType::Boolean,
|
||||||
VariableType::ScoreboardValue => ValueType::Integer,
|
VariableType::ScoreboardValue => ValueType::Integer,
|
||||||
VariableType::ComptimeValue => {
|
VariableType::ComptimeValue => {
|
||||||
// TODO: check if the expression is a constant expression
|
// TODO: check if the expression is a constant expression
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
VariableType::BooleanStorageArray | VariableType::Tag
|
||||||
|
if matches!(self.destination(), AssignmentDestination::Indexed(..)) =>
|
||||||
|
{
|
||||||
|
ValueType::Boolean
|
||||||
|
}
|
||||||
|
VariableType::Scoreboard | VariableType::ScoreboardArray
|
||||||
|
if matches!(self.destination(), AssignmentDestination::Indexed(..)) =>
|
||||||
|
{
|
||||||
|
ValueType::Integer
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let err = error::Error::AssignmentError(AssignmentError {
|
let err = error::Error::AssignmentError(AssignmentError {
|
||||||
identifier: self.destination().span(),
|
identifier: self.destination().span(),
|
||||||
|
|
Loading…
Reference in New Issue