From 266cefc3212791ad3a60c484ec89ed5b1c22bae6 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 3 Jul 2023 10:53:28 +0200 Subject: parser: rename block to nodes --- askama_derive/src/generator.rs | 6 +++--- askama_derive/src/heritage.rs | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'askama_derive/src') diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 66f1b1c..5308c02 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -762,7 +762,7 @@ impl<'a> Generator<'a> { buf.writeln(" {")?; - arm_size += self.handle(ctx, &cond.block, buf, AstLevel::Nested)?; + arm_size += self.handle(ctx, &cond.nodes, buf, AstLevel::Nested)?; arm_sizes.push(arm_size); } self.handle_ws(ws); @@ -809,7 +809,7 @@ impl<'a> Generator<'a> { self.visit_target(buf, true, true, &arm.target); buf.writeln(" => {")?; - arm_size = self.handle(ctx, &arm.block, buf, AstLevel::Nested)?; + arm_size = self.handle(ctx, &arm.nodes, buf, AstLevel::Nested)?; } self.handle_ws(ws2); @@ -881,7 +881,7 @@ impl<'a> Generator<'a> { buf.writeln("if !_did_loop {")?; self.locals.push(); - let mut size_hint2 = self.handle(ctx, &loop_block.else_block, buf, AstLevel::Nested)?; + let mut size_hint2 = self.handle(ctx, &loop_block.else_nodes, buf, AstLevel::Nested)?; self.handle_ws(loop_block.ws3); size_hint2 += self.write_buf_writable(buf)?; self.locals.pop(); diff --git a/askama_derive/src/heritage.rs b/askama_derive/src/heritage.rs index 342416e..9ef7aeb 100644 --- a/askama_derive/src/heritage.rs +++ b/askama_derive/src/heritage.rs @@ -84,18 +84,20 @@ impl Context<'_> { } Node::Cond(branches, _) => { for cond in branches { - nested.push(&cond.block); + nested.push(&cond.nodes); } } Node::Loop(Loop { - body, else_block, .. + body, + else_nodes: else_block, + .. }) => { nested.push(body); nested.push(else_block); } Node::Match(_, _, arms, _) => { for arm in arms { - nested.push(&arm.block); + nested.push(&arm.nodes); } } _ => {} -- cgit