1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use proc_macro2::TokenStream as TokenStream2;
use quote::{quote, quote_spanned};
use super::{Property, PropertyName, PropertyType, ReturnedWidget, Tracker, Widget, WidgetFunc};
mod util;
mod struct_fields;
mod init_widgets;
mod init_properties;
mod connect;
mod return_fields;
mod view;
mod track;
mod connect_widgets;
mod connect_components;
mod parent;
impl Widget {
pub fn widget_assignment(&self) -> TokenStream2 {
let w_name = &self.name;
let ref_token = &self.ref_token;
let deref_token = &self.deref_token;
let out_stream = quote! { #ref_token #deref_token #w_name };
if let Some(wrapper) = &self.wrapper {
quote_spanned! {
wrapper.span() => #wrapper(#out_stream)
}
} else {
out_stream
}
}
}