Split up if chains more
Signed-off-by: Marcel Müller <neikos@neikos.email>
This commit is contained in:
parent
383f543119
commit
c9314a3d9b
4 changed files with 90 additions and 21 deletions
|
|
@ -92,7 +92,6 @@ fn emit_ast_expr(
|
|||
let mut chain = chain.iter();
|
||||
let Some(TemplateAstExpr::IfConditional {
|
||||
if_block: expression,
|
||||
content,
|
||||
}) = chain.next()
|
||||
else {
|
||||
unreachable!("First element in conditional chain should be an IfConditional");
|
||||
|
|
@ -107,6 +106,10 @@ fn emit_ast_expr(
|
|||
unreachable!("The end of an IfConditional must be a Block");
|
||||
};
|
||||
|
||||
let Some(TemplateAstExpr::ConditionalContent { content }) = chain.next() else {
|
||||
unreachable!("The end of an IfConditional must be a Block");
|
||||
};
|
||||
|
||||
if let Some(ws) = prev_whitespace_content {
|
||||
eval.push(Instruction::AppendContent {
|
||||
content: ws.source().clone(),
|
||||
|
|
@ -163,6 +166,7 @@ fn emit_ast_expr(
|
|||
TemplateAstExpr::Block { .. }
|
||||
| TemplateAstExpr::EndBlock
|
||||
| TemplateAstExpr::IfConditional { .. }
|
||||
| TemplateAstExpr::ConditionalContent { .. }
|
||||
| TemplateAstExpr::ElseConditional { .. }
|
||||
| TemplateAstExpr::Invalid { .. }
|
||||
| TemplateAstExpr::VariableAccess { .. } => eval.push(Instruction::Abort),
|
||||
|
|
@ -191,6 +195,7 @@ fn emit_expr_load(
|
|||
TemplateAstExpr::EndBlock => todo!(),
|
||||
TemplateAstExpr::Block { .. } => todo!(),
|
||||
TemplateAstExpr::IfConditional { .. } => todo!(),
|
||||
TemplateAstExpr::ConditionalContent { .. } => todo!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue