aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
authorLibravatar PizzasBear <43722034+PizzasBear@users.noreply.github.com>2023-10-12 13:23:24 +0300
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-10-12 13:57:48 +0200
commitac73f1d535eb3c1fa5dcfbdbd4f8f10ca6ca0139 (patch)
treeecf4fb787963c1a7ba2ff154138d32780ecf55f6 /askama_derive
parentab281c82365a3cbf4f564e9245b008dbe04e59a7 (diff)
downloadaskama-ac73f1d535eb3c1fa5dcfbdbd4f8f10ca6ca0139.tar.gz
askama-ac73f1d535eb3c1fa5dcfbdbd4f8f10ca6ca0139.tar.bz2
askama-ac73f1d535eb3c1fa5dcfbdbd4f8f10ca6ca0139.zip
Allow macros to take `self` as an argument
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs2
1 files changed, 1 insertions, 1 deletions
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));
}