mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Fix compiler panic when trying to set a function in a state
Fixes #5246
This commit is contained in:
parent
3f32550859
commit
bc8e18e148
2 changed files with 38 additions and 1 deletions
|
@ -1407,7 +1407,16 @@ impl Element {
|
|||
.StatePropertyChange()
|
||||
.filter_map(|s| {
|
||||
lookup_property_from_qualified_name_for_state(s.QualifiedName(), &r, diag)
|
||||
.map(|(ne, _)| {
|
||||
.map(|(ne, ty)| {
|
||||
if !ty.is_property_type() && !matches!(ty, Type::Invalid) {
|
||||
diag.push_error(
|
||||
format!(
|
||||
"'{}' is not a property",
|
||||
s.QualifiedName().to_string()
|
||||
),
|
||||
&s,
|
||||
);
|
||||
}
|
||||
(ne, Expression::Uncompiled(s.BindingExpression().into()), s)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
||||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial
|
||||
|
||||
export component Ball inherits HorizontalLayout{
|
||||
in property <bool> replaceAll: false;
|
||||
property <bool> replaceable: true;
|
||||
in property <string> name:"";
|
||||
spacing: 10px;
|
||||
height: 30px;
|
||||
animate height { duration: 300ms; easing: linear; delay: 200ms;}
|
||||
|
||||
|
||||
function animate() {
|
||||
root.height = 0px;
|
||||
}
|
||||
|
||||
callback clicked;
|
||||
|
||||
states [
|
||||
replaced when replaceable && replaceAll: {
|
||||
root.height: 50px;
|
||||
root.animate: 30px;
|
||||
// ^error{'root.animate' is not a property}
|
||||
root.clicked: "blue";
|
||||
// ^error{'root.clicked' is not a property}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue