Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds if-expressions, closes #436. Each arm of the if currently must be a simple expression; could be extended in a future PR to support blocks of commands that return an expression, if necessary.
Represented in the IR as another member of
ir::Exprthat takes a condition (ir::Prop) and two expressions. This worked pretty okay, just had to do some reshuffling of code in the monomorphize pass to be able to handleProps at the same time we handleExprs.One sort of weird thing happens in
Discharge, where we need to convert the if's condition (aProp) to anSExpas we are converting all of a component'sExprs, which happens before we do the rest of the component'sProps. This means that we need to push things toDischarge::prop_mapout of order, which means thatSExprneeds to implementDefault. We can't implementDefaultforSExpr, so I made a wrapperSExprWrapperthat is either anSExprorSExprEmpty, which lets us implementDefault. This is a little wonky, but I couldn't really come up with a way around this.