use brink_syntax::ast;
use crate::{ContentPart, Stmt};
use super::super::conditional::{lower_inline_logic_into_parts, lower_multiline_block_from_inline};
use super::super::context::{LowerScope, LowerSink, Lowered};
use super::LowerBody;
pub enum InlineLogicOutput {
Block(Stmt),
Inline(Vec<ContentPart>),
}
impl LowerBody for ast::InlineLogic {
type Output = InlineLogicOutput;
fn lower_body(
&self,
scope: &LowerScope,
sink: &mut impl LowerSink,
) -> Lowered<InlineLogicOutput> {
if let Some(stmt) = lower_multiline_block_from_inline(self, scope, sink) {
return Ok(InlineLogicOutput::Block(stmt));
}
let mut parts = Vec::new();
lower_inline_logic_into_parts(self, &mut parts, scope, sink);
Ok(InlineLogicOutput::Inline(parts))
}
}