desugar ValueDef::Expect suffixed nodes

This commit is contained in:
Luke Boswell 2024-09-23 17:57:25 +10:00
parent 5f3a956137
commit cce33c03d6
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
3 changed files with 330 additions and 1 deletions

View file

@ -290,8 +290,21 @@ pub fn desugar_value_def_suffixed<'a>(arena: &'a Bump, value_def: ValueDef<'a>)
}
}
Expect {
condition,
preceding_comment,
} => match unwrap_suffixed_expression(arena, condition, None) {
Ok(new_condition) => ValueDef::Expect {
condition: new_condition,
preceding_comment,
},
Err(..) => {
internal_error!("Unable to desugar the suffix inside an Expect value def");
}
},
// TODO support desugaring of Dbg, Expect, and ExpectFx
Dbg { .. } | Expect { .. } | ExpectFx { .. } => value_def,
Dbg { .. } | ExpectFx { .. } => value_def,
ModuleImport { .. } | IngestedFileImport(_) => value_def,
Stmt(..) => {