From ac73f1d535eb3c1fa5dcfbdbd4f8f10ca6ca0139 Mon Sep 17 00:00:00 2001 From: PizzasBear <43722034+PizzasBear@users.noreply.github.com> Date: Thu, 12 Oct 2023 13:23:24 +0300 Subject: Allow macros to take `self` as an argument --- askama_derive/src/generator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'askama_derive') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 76b775b..6f561f8 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -952,7 +952,7 @@ impl<'a> Generator<'a> { // If `expr` is already a form of variable then // don't reintroduce a new variable. This is // to avoid moving non-copyable values. - Expr::Var(name) => { + &Expr::Var(name) if name != "self" => { let var = self.locals.resolve_or_self(name); self.locals.insert(arg, LocalMeta::with_ref(var)); } -- cgit