-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added when keyword #43
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1112,11 +1112,13 @@ impl<'l, 'errs> FlatteningContext<'l, 'errs> { | |
|
||
fn flatten_if_statement(&mut self, cursor: &mut Cursor) { | ||
cursor.go_down(kind!("if_statement"), |cursor| { | ||
cursor.field(field!("if_literal")); | ||
let literal_is_when = cursor.kind() == kw!("when"); | ||
cursor.field(field!("condition")); | ||
let (condition, condition_is_generative) = self.flatten_expr(cursor); | ||
|
||
let if_id = self.instructions.alloc(Instruction::IfStatement(IfStatement { | ||
condition, | ||
is_when: literal_is_when, | ||
is_generative: condition_is_generative,// TODO `if` vs `when` https://github.com/pc2/sus-compiler/issues/3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's TODO's like this one scattered around the codebase. I believe you can get rid of |
||
then_start: FlatID::PLACEHOLDER, | ||
then_end_else_start: FlatID::PLACEHOLDER, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a little rust trick here, if you rename
literal_is_when
to justis_when
, then you can omit the is_when: literal_is_when al-togehter