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.
Breaking recursion in
enum Expr
done differently hereNote that in
enum Expr
in asg.rs, variants before this PR have looked like this:openqasm3_parser/crates/oq3_semantics/src/asg.rs
Lines 118 to 121 in b174b2b
For
return
expressions we introduce a variantReturn(Box<ReturnExpression>)
. This probably means that consumers have to treatReturn
differently because the indirection happens in a different place (in the variant). The other choice would be to continue with the previous pattern of putting theBox
in the structReturnExpression
.It probably makes sense to choose one way and do it uniformly.
Change in
fn from_expr
insyntax_to_semantics.rs
Before the expression from the AST was unwrapped and passed to
from_expr
. This is changed in this PR. Now we pass theOption
tofrom_expr
. This simplifies much code in syntax_to_semantics.rs (as is evident by looking at this PR).panic
s due tounwrap
will be moved to different places in the code. Of course, eventually, we need to avoid panic ing altogether.Note that there is a check for
return
in global scope. But we need something more systematic than thisCloses #133