mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Add boolean flag to Expr::If for indented else statement
This commit is contained in:
parent
00572cbc83
commit
a7afac7ac7
8 changed files with 136 additions and 47 deletions
|
@ -1249,7 +1249,11 @@ pub fn canonicalize_expr<'a>(
|
|||
output,
|
||||
)
|
||||
}
|
||||
ast::Expr::If(if_thens, final_else_branch) => {
|
||||
ast::Expr::If {
|
||||
if_thens,
|
||||
final_else: final_else_branch,
|
||||
..
|
||||
} => {
|
||||
let mut branches = Vec::with_capacity(if_thens.len());
|
||||
let mut output = Output::default();
|
||||
|
||||
|
@ -2560,7 +2564,11 @@ pub fn is_valid_interpolation(expr: &ast::Expr<'_>) -> bool {
|
|||
.iter()
|
||||
.all(|(loc_expr, _binop)| is_valid_interpolation(&loc_expr.value))
|
||||
}
|
||||
ast::Expr::If(branches, final_branch) => {
|
||||
ast::Expr::If {
|
||||
if_thens: branches,
|
||||
final_else: final_branch,
|
||||
..
|
||||
} => {
|
||||
is_valid_interpolation(&final_branch.value)
|
||||
&& branches.iter().all(|(loc_before, loc_after)| {
|
||||
is_valid_interpolation(&loc_before.value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue