aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-08-01 03:09:35 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-08-01 13:04:41 +0200
commit222c42917aa19162562b8a9c35350e3e992f9823 (patch)
tree055f247d144e72c0bdd167ce8313f87aadca6b21 /askama_derive
parentffe267be7a725c776ebc92d6551e8a070aadf254 (diff)
downloadaskama-222c42917aa19162562b8a9c35350e3e992f9823.tar.gz
askama-222c42917aa19162562b8a9c35350e3e992f9823.tar.bz2
askama-222c42917aa19162562b8a9c35350e3e992f9823.zip
parser: let `Macro` know its name
Diffstat (limited to 'askama_derive')
-rw-r--r--askama_derive/src/generator.rs2
-rw-r--r--askama_derive/src/heritage.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 5308c02..1c6e722 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -659,7 +659,7 @@ impl<'a> Generator<'a> {
Node::Call(ws, scope, name, ref args) => {
size_hint += self.write_call(ctx, buf, ws, scope, name, args)?;
}
- Node::Macro(_, ref m) => {
+ Node::Macro(ref m) => {
if level != AstLevel::Top {
return Err("macro blocks only allowed at the top level".into());
}
diff --git a/askama_derive/src/heritage.rs b/askama_derive/src/heritage.rs
index 9ef7aeb..801b109 100644
--- a/askama_derive/src/heritage.rs
+++ b/askama_derive/src/heritage.rs
@@ -64,14 +64,14 @@ impl Context<'_> {
extends = Some(config.find_template(extends_path, Some(path))?);
}
},
- Node::Macro(name, m) if top => {
- macros.insert(*name, m);
+ Node::Macro(m) if top => {
+ macros.insert(m.name, m);
}
Node::Import(_, import_path, scope) if top => {
let path = config.find_template(import_path, Some(path))?;
imports.insert(*scope, path);
}
- Node::Extends(_) | Node::Macro(_, _) | Node::Import(_, _, _) if !top => {
+ Node::Extends(_) | Node::Macro(_) | Node::Import(_, _, _) if !top => {
return Err(
"extends, macro or import blocks not allowed below top level".into(),
);