aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src
diff options
context:
space:
mode:
authorLibravatar bott <mhpoin@gmail.com>2018-09-02 18:46:45 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-09-02 19:02:22 +0200
commitdfb7cea03794ead892527e19f883dc8a3e784bc7 (patch)
tree0e36679782e5ac02be167a78b67d8a90ce65644b /askama_derive/src
parent6aa485ec0892125e9b67085afb400bc9e27e6a8d (diff)
downloadaskama-dfb7cea03794ead892527e19f883dc8a3e784bc7.tar.gz
askama-dfb7cea03794ead892527e19f883dc8a3e784bc7.tar.bz2
askama-dfb7cea03794ead892527e19f883dc8a3e784bc7.zip
Fix multiple nesting in macro calls into different scopes
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index b771234..81c0e27 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -427,13 +427,15 @@ impl<'a> Generator<'a> {
return;
}
- let def = if let Some(s) = match scope {
+ let own_scope = match scope {
None => match level {
AstLevel::Nested(s) => s,
_ => None,
},
s => s,
- } {
+ };
+
+ let def = if let Some(s) = own_scope {
let path = ctx
.imports
.get(s)
@@ -464,7 +466,7 @@ impl<'a> Generator<'a> {
buf.writeln(&format!("let {} = &{};", arg, expr_code));
self.locals.insert(arg);
}
- self.handle(ctx, &def.nodes, buf, AstLevel::Nested(scope));
+ self.handle(ctx, &def.nodes, buf, AstLevel::Nested(own_scope));
self.flush_ws(buf, def.ws2);
buf.writeln("}");