From 5e1a7384e47e01157d6a8b3beb42b57026c417e8 Mon Sep 17 00:00:00 2001 From: Nathan Lapel Date: Wed, 18 Mar 2020 22:09:00 +0100 Subject: Use _visit_args in var/path calls --- askama_shared/src/generator.rs | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'askama_shared/src/generator.rs') diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index fb8619e..d904524 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1030,7 +1030,10 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { } let scoped = match *arg { - Expr::Filter(_, _) | Expr::MethodCall(_, _, _) => true, + Expr::Filter(_, _) + | Expr::MethodCall(_, _, _) + | Expr::VarCall(_, _) + | Expr::PathCall(_, _) => true, _ => false, }; @@ -1169,13 +1172,8 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { } buf.write(part); } - buf.write("("); - for (i, arg) in args.iter().enumerate() { - if i > 0 { - buf.write(","); - } - self.visit_expr(buf, arg); - } + buf.write("(&"); + self._visit_args(buf, args); buf.write(")"); DisplayWrap::Unwrapped } @@ -1198,13 +1196,8 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { buf.write("self."); buf.write(s); } - buf.write(")("); - for (i, arg) in args.iter().enumerate() { - if i > 0 { - buf.write(","); - } - self.visit_expr(buf, arg); - } + buf.write(")(&"); + self._visit_args(buf, args); buf.write(")"); DisplayWrap::Unwrapped } -- cgit