handle positional_args
This commit is contained in:
1 parent
06390b9be5
commit
c1072aa95a
3 files changed
+17
-7
No files matched your search
@@ -6,7 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
syn = "1.0"
|
syn = "1.0"
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
dioxus-rsx = { path = "../rsx" }
|
dioxus-rsx = { path = "../rsx", default-features = false }
|
||||||
dioxus-ssr = { path = "../ssr" }
|
dioxus-ssr = { path = "../ssr" }
|
||||||
dioxus-core = { path = "../core" }
|
dioxus-core = { path = "../core" }
|
||||||
dioxus-html = { path = "../html" }
|
dioxus-html = { path = "../html" }
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ impl CapturedContextBuilder {
|
|||||||
captured.captured_expressions.push(value);
|
captured.captured_expressions.push(value);
|
||||||
}
|
}
|
||||||
ElementAttr::EventTokens { .. } => captured.listeners.push(attr),
|
ElementAttr::EventTokens { .. } => captured.listeners.push(attr),
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for child in el.children {
|
for child in el.children {
|
||||||
@@ -71,7 +70,6 @@ impl CapturedContextBuilder {
|
|||||||
captured.text.push(formated);
|
captured.text.push(formated);
|
||||||
}
|
}
|
||||||
BodyNode::RawExpr(_) => captured.iterators.push(node),
|
BodyNode::RawExpr(_) => captured.iterators.push(node),
|
||||||
BodyNode::Meta(_) => (),
|
|
||||||
}
|
}
|
||||||
captured
|
captured
|
||||||
}
|
}
|
||||||
@@ -97,14 +95,27 @@ impl ToTokens for CapturedContextBuilder {
|
|||||||
BodyNode::RawExpr(expr) => expr.to_token_stream().to_string(),
|
BodyNode::RawExpr(expr) => expr.to_token_stream().to_string(),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
});
|
});
|
||||||
let captured: Vec<_> = attributes
|
let captured_named: Vec<_> = attributes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(_, fmt)| fmt.named_args.iter())
|
.map(|(_, fmt)| fmt.named_args.iter())
|
||||||
.chain(text.iter().map(|fmt| fmt.named_args.iter()))
|
.chain(text.iter().map(|fmt| fmt.named_args.iter()))
|
||||||
.flatten()
|
.flatten()
|
||||||
.collect();
|
.collect();
|
||||||
let captured_names = captured.iter().map(|(n, _)| n.to_string());
|
let captured_expr: Vec<_> = attributes
|
||||||
let captured_expr = captured.iter().map(|(_, e)| e);
|
.iter()
|
||||||
|
.map(|(_, fmt)| fmt.positional_args.iter())
|
||||||
|
.chain(text.iter().map(|fmt| fmt.positional_args.iter()))
|
||||||
|
.flatten()
|
||||||
|
.collect();
|
||||||
|
let captured_names = captured_named.iter().map(|(n, _)| n.to_string()).chain(
|
||||||
|
captured_expr
|
||||||
|
.iter()
|
||||||
|
.map(|expr| expr.to_token_stream().to_string()),
|
||||||
|
);
|
||||||
|
let captured_expr = captured_named
|
||||||
|
.iter()
|
||||||
|
.map(|(_, e)| e)
|
||||||
|
.chain(captured_expr.iter().map(|expr| *expr));
|
||||||
let captured_attr_expressions_text = captured_expressions
|
let captured_attr_expressions_text = captured_expressions
|
||||||
.iter()
|
.iter()
|
||||||
.map(|e| format!("{}", e.to_token_stream()));
|
.map(|e| format!("{}", e.to_token_stream()));
|
||||||
|
|||||||
@@ -259,6 +259,5 @@ fn build_node<'a>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BodyNode::Meta(_) => todo!(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user