aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-08-01 03:22:08 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-08-01 13:04:41 +0200
commit4f52dbe8be9746d1f1a2eab03e135c9003ef6dd3 (patch)
tree8e3469529aff9e0538c24e854c56f1f6e643368e /askama_derive/src/generator.rs
parentcd075630eab578a66afec6000ce0f266e6b281e8 (diff)
downloadaskama-4f52dbe8be9746d1f1a2eab03e135c9003ef6dd3.tar.gz
askama-4f52dbe8be9746d1f1a2eab03e135c9003ef6dd3.tar.bz2
askama-4f52dbe8be9746d1f1a2eab03e135c9003ef6dd3.zip
parser: add type for `Node::Call`
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs17
1 files changed, 10 insertions, 7 deletions
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<usize, CompileError> {
+ let Call {
+ ws,
+ scope,
+ name,
+ ref args,
+ } = *call;
if name == "super" {
return self.write_block(buf, None, ws);
}