fix comptime variable errors
This commit is contained in:
parent
15dde037b7
commit
e0c3253ab6
|
@ -706,13 +706,14 @@ impl Primary {
|
|||
_ => false,
|
||||
},
|
||||
Self::MemberAccess(_) => {
|
||||
// TODO:
|
||||
// TODO: correct return value after check
|
||||
true
|
||||
}
|
||||
Self::Identifier(ident) => match scope.get_variable(ident.span.str()) {
|
||||
Some(VariableType::BooleanStorage) => expected == ValueType::Boolean,
|
||||
Some(VariableType::ScoreboardValue) => expected == ValueType::Integer,
|
||||
Some(VariableType::Tag) => expected == ValueType::String,
|
||||
Some(VariableType::ComptimeValue) => true,
|
||||
_ => false,
|
||||
},
|
||||
Self::Prefix(prefixed) => match prefixed.operator() {
|
||||
|
|
|
@ -1154,12 +1154,25 @@ impl Parser<'_> {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
None => Ok(VariableDeclaration::Single(SingleVariableDeclaration {
|
||||
variable_type,
|
||||
identifier,
|
||||
assignment,
|
||||
annotations: VecDeque::new(),
|
||||
})),
|
||||
None => {
|
||||
if matches!(variable_type.keyword, KeywordKind::Val) {
|
||||
Ok(VariableDeclaration::ComptimeValue(
|
||||
ComptimeValueDeclaration {
|
||||
val_keyword: variable_type,
|
||||
identifier,
|
||||
assignment,
|
||||
annotations: VecDeque::new(),
|
||||
},
|
||||
))
|
||||
} else {
|
||||
Ok(VariableDeclaration::Single(SingleVariableDeclaration {
|
||||
variable_type,
|
||||
identifier,
|
||||
assignment,
|
||||
annotations: VecDeque::new(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue