Conversation
|
The golden IRs have changed: a68dbb9..3e506fd |
| } | ||
| CstKind::MatchCase { | ||
| pattern, | ||
| condition: _, // TODO: format match case conditions |
compiler/frontend/src/mir/body.rs
Outdated
| &mut self, | ||
| hir_id: &hir::Id, | ||
| condition: Id, | ||
| else_builder: E, |
There was a problem hiding this comment.
You can inline the constraint so there are no type parameters anymore.
| else_builder: E, | |
| else_builder: impl FnOnce(&mut Self), |
There was a problem hiding this comment.
Should I also apply this to the rest of this class (I was matching the style of other methods in this class)?
There was a problem hiding this comment.
I think we should eventually use it where applicable, but that can be done over time. I think the feature is relatively recent, so we only used it for new code and didn't update everything yet
compiler/frontend/src/rcst.rs
Outdated
| impl ToRichIr for Rcst { | ||
| fn build_rich_ir(&self, builder: &mut RichIrBuilder) { | ||
| builder.push(format!("{self:?}"), None, EnumSet::empty()); | ||
| builder.push(format!("{self:#?}"), None, EnumSet::empty()); |
There was a problem hiding this comment.
The CST's rich IR is currently messed up and I suspect it comes from this change
| let (input, condition) = if let Some((input, condition_comma)) = comma(input) { | ||
| let (input, whitespace) = whitespaces_and_newlines(input, indentation, true); | ||
| let condition_comma = condition_comma.wrap_in_whitespace(whitespace); | ||
| if let Some((input, condition_expresion)) = expression( |
There was a problem hiding this comment.
Small typo: condition_expresion is missing one “s”
There was a problem hiding this comment.
If you completely addressed a review comment and didn't write an answer, you can directly resolve the conversation yourself
compiler/frontend/src/hir_to_mir.rs
Outdated
| // something % | ||
| // foo -> ... |
There was a problem hiding this comment.
| // something % | |
| // foo -> ... | |
| // foo = … | |
| // | |
| // or: | |
| // | |
| // something % | |
| // foo -> ... |
There was a problem hiding this comment.
Moved to further up in this file
7f46941 to
38f30f4
Compare
Closes: #659
Added optional condtions to match cases in RCST, AST, and HIR, which are resolved to if/else in MIR.
Checklist