mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Handle space/parens around record builders
This commit is contained in:
parent
dfa9c29147
commit
627437c65b
1 changed files with 16 additions and 9 deletions
|
@ -269,7 +269,9 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
||||||
let mut builder_apply_exprs = None;
|
let mut builder_apply_exprs = None;
|
||||||
|
|
||||||
for loc_arg in loc_args.iter() {
|
for loc_arg in loc_args.iter() {
|
||||||
let arg = match loc_arg.value {
|
let mut current = loc_arg.value;
|
||||||
|
let arg = loop {
|
||||||
|
match current {
|
||||||
RecordBuilder(fields) => {
|
RecordBuilder(fields) => {
|
||||||
if builder_apply_exprs.is_some() {
|
if builder_apply_exprs.is_some() {
|
||||||
todo!("Compiler error: A function application can only be passed one record builder")
|
todo!("Compiler error: A function application can only be passed one record builder")
|
||||||
|
@ -277,9 +279,14 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
||||||
|
|
||||||
let builder_arg = record_builder_arg(arena, loc_arg.region, fields);
|
let builder_arg = record_builder_arg(arena, loc_arg.region, fields);
|
||||||
builder_apply_exprs = Some(builder_arg.apply_exprs);
|
builder_apply_exprs = Some(builder_arg.apply_exprs);
|
||||||
builder_arg.closure
|
|
||||||
|
break builder_arg.closure;
|
||||||
|
}
|
||||||
|
SpaceBefore(expr, _) | SpaceAfter(expr, _) | ParensAround(expr) => {
|
||||||
|
current = *expr;
|
||||||
|
}
|
||||||
|
_ => break loc_arg,
|
||||||
}
|
}
|
||||||
_ => loc_arg,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
desugared_args.push(desugar_expr(arena, arg));
|
desugared_args.push(desugar_expr(arena, arg));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue