simplify
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-07-19 08:42:08 +03:00
parent 291b917970
commit 7b67d29c01
19 changed files with 769 additions and 898 deletions

View file

@ -50,7 +50,7 @@ impl ToTokens for ViewDef {
impl ViewDef {
fn generated (&self) -> impl ToTokens {
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
let Self(ViewMeta { output }, ViewImpl { block, .. }) = self;
let self_ty = &block.self_ty;
let builtins = self.builtins();
let exposed = self.exposed();
@ -74,7 +74,7 @@ impl ViewDef {
/// Expressions are handled by built-in functions
/// that operate over constants and symbols.
fn builtins (&self) -> impl ToTokens {
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
let Self(ViewMeta { output }, ViewImpl { .. }) = self;
let builtins = builtins_with_boxes_output(quote! { #output }).map(|builtin|quote! {
::tengri::dsl::Val::Exp(_, expr) => return Ok(Some(
#builtin::from_dsl(self, expr, ||Box::new("failed to load builtin".into()))?
@ -85,7 +85,7 @@ impl ViewDef {
}
/// Symbols are handled by user-taked functions that take no parameters but `&self`.
fn exposed (&self) -> impl ToTokens {
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
let Self(ViewMeta { .. }, ViewImpl { exposed, .. }) = self;
let exposed = exposed.iter().map(|(key, value)|write_quote(quote! {
#key => return Ok(Some(self.#value().boxed())),
}));