From 4f52dbe8be9746d1f1a2eab03e135c9003ef6dd3 Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Tue, 1 Aug 2023 03:22:08 +0200 Subject: parser: add type for `Node::Call` --- askama_derive/src/generator.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'askama_derive/src/generator.rs') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 8a2c0e3..d29c4c3 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -2,7 +2,7 @@ use crate::config::{get_template_source, read_config_file, Config, WhitespaceHan use crate::heritage::{Context, Heritage}; use crate::input::{Print, Source, TemplateInput}; use crate::CompileError; -use parser::{Cond, CondTest, Expr, Loop, Node, Parsed, Target, When, Whitespace, Ws}; +use parser::{Call, Cond, CondTest, Expr, Loop, Node, Parsed, Target, When, Whitespace, Ws}; use proc_macro::TokenStream; use quote::{quote, ToTokens}; @@ -656,8 +656,8 @@ impl<'a> Generator<'a> { Node::Include(ws, path) => { size_hint += self.handle_include(ctx, buf, ws, path)?; } - Node::Call(ws, scope, name, ref args) => { - size_hint += self.write_call(ctx, buf, ws, scope, name, args)?; + Node::Call(ref call) => { + size_hint += self.write_call(ctx, buf, call)?; } Node::Macro(ref m) => { if level != AstLevel::Top { @@ -896,11 +896,14 @@ impl<'a> Generator<'a> { &mut self, ctx: &'a Context<'_>, buf: &mut Buffer, - ws: Ws, - scope: Option<&str>, - name: &str, - args: &[Expr<'_>], + call: &'a Call<'_>, ) -> Result { + let Call { + ws, + scope, + name, + ref args, + } = *call; if name == "super" { return self.write_block(buf, None, ws); } -- cgit