Skip to content

Commit

Permalink
Rename internal enum methods for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Nov 10, 2024
1 parent c2ec7f6 commit d0336e1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions minijinja/src/compiler/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ pub struct Call<'a> {
pub enum CallArg<'a> {
Pos(Expr<'a>),
Kwarg(&'a str, Expr<'a>),
Splat(Expr<'a>),
KwargsSplat(Expr<'a>),
PosSplat(Expr<'a>),
KwargSplat(Expr<'a>),
}

/// Creates a list of values.
Expand Down
8 changes: 4 additions & 4 deletions minijinja/src/compiler/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ impl<'source> CodeGenerator<'source> {
self.compile_expr(expr);
pending_args += 1;
}
ast::CallArg::Splat(expr) => {
ast::CallArg::PosSplat(expr) => {
if pending_args > 0 {
self.add(Instruction::BuildList(Some(pending_args)));
pending_args = 0;
Expand All @@ -778,7 +778,7 @@ impl<'source> CodeGenerator<'source> {
}
has_kwargs = true;
}
ast::CallArg::KwargsSplat(_) => {
ast::CallArg::KwargSplat(_) => {
static_kwargs = false;
has_kwargs = true;
}
Expand All @@ -804,7 +804,7 @@ impl<'source> CodeGenerator<'source> {
pending_kwargs += 1;
}
}
ast::CallArg::KwargsSplat(expr) => {
ast::CallArg::KwargSplat(expr) => {
if pending_kwargs > 0 {
self.add(Instruction::BuildKwargs(pending_kwargs));
num_kwargs_batches += 1;
Expand All @@ -813,7 +813,7 @@ impl<'source> CodeGenerator<'source> {
self.compile_expr(expr);
num_kwargs_batches += 1;
}
ast::CallArg::Pos(_) | ast::CallArg::Splat(_) => {}
ast::CallArg::Pos(_) | ast::CallArg::PosSplat(_) => {}
}
}

Expand Down
4 changes: 2 additions & 2 deletions minijinja/src/compiler/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ fn tracker_visit_callarg<'a>(callarg: &ast::CallArg<'a>, state: &mut AssignmentT
match callarg {
ast::CallArg::Pos(expr)
| ast::CallArg::Kwarg(_, expr)
| ast::CallArg::Splat(expr)
| ast::CallArg::KwargsSplat(expr) => tracker_visit_expr(expr, state),
| ast::CallArg::PosSplat(expr)
| ast::CallArg::KwargSplat(expr) => tracker_visit_expr(expr, state),
}
}

Expand Down
4 changes: 2 additions & 2 deletions minijinja/src/compiler/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,10 @@ impl<'a> Parser<'a> {
}
}
ArgType::Splat => {
args.push(ast::CallArg::Splat(expr));
args.push(ast::CallArg::PosSplat(expr));
}
ArgType::KwargsSplat => {
args.push(ast::CallArg::KwargsSplat(expr));
args.push(ast::CallArg::KwargSplat(expr));
has_kwargs = true;
}
}
Expand Down

0 comments on commit d0336e1

Please sign in to comment.