Skip to content
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

Clean up parsing (if ...) #1215

Merged
merged 2 commits into from
Sep 25, 2023

Conversation

alexcrichton
Copy link
Member

Much of this code dates back to when this crate was trying to parse all of WABT's tests as well as the upstream test suite. WABT at the time had syntactical forms that weren't technically supposed to be valid given the upstream test suite, so at the time more was accepted than should be.

This commit fixes how (if ...) is parsed to require (then ..) and (else ..) wrappers. Previously these were mistakenly only optional. Additionally this fixes #1213 by allowing multiple condition-related folded expressions before (then ..).

This updates a few of the golden outputs for the spec test suites, notably those that use (if (foo) (then) (else)) where previously wast would erroneously not emit an else instruction but now it does.

Closes #1213

Much of this code dates back to when this crate was trying to parse all
of WABT's tests as well as the upstream test suite. WABT at the time had
syntactical forms that weren't technically supposed to be valid given
the upstream test suite, so at the time more was accepted than should be.

This commit fixes how `(if ...)` is parsed to require `(then ..)` and
`(else ..)` wrappers. Previously these were mistakenly only optional.
Additionally this fixes bytecodealliance#1213 by allowing multiple condition-related
folded expressions before `(then ..)`.

This updates a few of the golden outputs for the spec test suites,
notably those that use `(if (foo) (then) (else))` where previously
`wast` would erroneously not emit an `else` instruction but now it does.

Closes bytecodealliance#1213
@alexcrichton alexcrichton merged commit 585a0bd into bytecodealliance:main Sep 25, 2023
15 checks passed
@alexcrichton alexcrichton deleted the fix-if-parsing branch September 25, 2023 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wast: does not support recently added atypical condition test
2 participants