-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, we construct if / else statements separately:
/// Creates a new if statement
pub fn new_if<C, E>(condition: C, then_block: Vec<E>) -> ControlFlowNode
where
C: Into<ExprKind>,
E: Into<AstKind>,
{
ControlFlowNode::new(
ControlFlowType::If,
Some(condition),
then_block
.into_iter()
.map(Into::into)
.collect::<Vec<AstKind>>(),
)
}
/// Creates a new else statement
pub fn new_else<T>(else_block: Vec<T>) -> ControlFlowNode
where
T: Into<AstKind>,
{
ControlFlowNode::new(
ControlFlowType::Else,
None::<ExprKind>,
else_block
.into_iter()
.map(Into::into)
.collect::<Vec<AstKind>>(),
)
}Instead, we should shift to a unified if / else block with an optional else body if one exists. This will make transformations easier.
We will need to change ControlFlowNode to reflect this change.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request