mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
compiler: Fix function constness marking
This commit is contained in:
parent
848e54a9ac
commit
d173fa0ba9
1 changed files with 3 additions and 1 deletions
|
@ -1047,7 +1047,9 @@ impl Expression {
|
|||
Expression::StructFieldAccess { base, .. } => base.is_constant(),
|
||||
Expression::ArrayIndex { array, index } => array.is_constant() && index.is_constant(),
|
||||
Expression::Cast { from, .. } => from.is_constant(),
|
||||
Expression::CodeBlock(sub) => sub.len() == 1 && sub.first().unwrap().is_constant(),
|
||||
// This is conservative: the return value is the last expression in the block, but
|
||||
// we kind of mean "pure" here too, so ensure the whole body is OK.
|
||||
Expression::CodeBlock(sub) => sub.iter().all(|s| s.is_constant()),
|
||||
Expression::FunctionCall { function, arguments, .. } => {
|
||||
let is_const = match function {
|
||||
Callable::Builtin(b) => b.is_const(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue