Add @rust-attr on scturct (#2785)

Fixes: #2660
This commit is contained in:
Amirhossein Akhlaghpour 2023-06-05 17:59:55 +03:30 committed by GitHub
parent bef2e3617d
commit 3a4f3c61d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 196 additions and 16 deletions

View file

@ -60,6 +60,8 @@ pub enum Type {
name: Option<String>,
/// When declared in .slint, this is the node of the declaration.
node: Option<syntax_nodes::ObjectType>,
/// deriven
rust_attributes: Option<Vec<String>>,
},
Enumeration(Rc<Enumeration>),
@ -104,8 +106,8 @@ impl core::cmp::PartialEq for Type {
Type::Easing => matches!(other, Type::Easing),
Type::Brush => matches!(other, Type::Brush),
Type::Array(a) => matches!(other, Type::Array(b) if a == b),
Type::Struct { fields, name, node: _ } => {
matches!(other, Type::Struct{fields: f, name: n, node: _} if fields == f && name == n)
Type::Struct { fields, name, node: _, rust_attributes: _ } => {
matches!(other, Type::Struct{fields:f,name:n,node:_, rust_attributes: _ } if fields == f && name == n)
}
Type::Enumeration(lhs) => matches!(other, Type::Enumeration(rhs) if lhs == rhs),
Type::UnitProduct(a) => matches!(other, Type::UnitProduct(b) if a == b),