mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
Issue a warning when accessing a deprecated property through component scopes
This commit is contained in:
parent
c771bcff45
commit
e8b64be9bd
3 changed files with 10 additions and 1 deletions
|
@ -584,6 +584,9 @@ impl Expression {
|
||||||
let PropertyLookupResult { resolved_name, property_type } =
|
let PropertyLookupResult { resolved_name, property_type } =
|
||||||
elem.borrow().lookup_property(&first_str);
|
elem.borrow().lookup_property(&first_str);
|
||||||
if property_type.is_property_type() {
|
if property_type.is_property_type() {
|
||||||
|
if resolved_name.as_ref() != &first_str {
|
||||||
|
ctx.diag.push_property_deprecation_warning(&first_str, &resolved_name, &first);
|
||||||
|
}
|
||||||
let prop = Self::PropertyReference(NamedReference {
|
let prop = Self::PropertyReference(NamedReference {
|
||||||
element: Rc::downgrade(&elem),
|
element: Rc::downgrade(&elem),
|
||||||
name: resolved_name.to_string(),
|
name: resolved_name.to_string(),
|
||||||
|
|
|
@ -20,4 +20,10 @@ Xxx := Rectangle {
|
||||||
duration: 250ms;
|
duration: 250ms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callback not_called;
|
||||||
|
not_called() => {
|
||||||
|
color = #000000;
|
||||||
|
// ^warning{The property 'color' has been deprecated. Please use 'background' instead}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ Xxx := Rectangle {
|
||||||
property <color> glop_col;
|
property <color> glop_col;
|
||||||
property <string> blah: "yo";
|
property <string> blah: "yo";
|
||||||
plop(x, blah, hello) => {
|
plop(x, blah, hello) => {
|
||||||
color = blah;
|
background = blah;
|
||||||
x = 42 + hello;
|
x = 42 + hello;
|
||||||
// ^error{Assignement need to be done on a property}
|
// ^error{Assignement need to be done on a property}
|
||||||
width = x;
|
width = x;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue