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
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use crate::widgets::{IfBranch, IfCondition};
impl IfBranch {
pub(crate) fn update_stream(
&self,
stream: &mut TokenStream2,
inner_update_tokens: &TokenStream2,
index: usize,
) {
let index = index.to_string();
stream.extend(match &self.cond {
IfCondition::If(if_token, expr) => quote! {
#if_token #expr
},
IfCondition::ElseIf(else_token, if_token, expr) => quote! {
#else_token #if_token #expr
},
IfCondition::Else(else_token) => quote! {
#else_token
},
});
stream.extend(quote! {
{
let __page_active: bool = (__current_page == #index);
#inner_update_tokens
#index
}
});
}
}