Repository navigation
wast: accept import/export attributes in any order - #2780
Merged
alexcrichton merged 1 commit intoOct 21, 2026
Merged
Conversation
jrandolf
marked this pull request as ready for review
October 19, 2026 22:28
The component model text format specifies the `implements`, `version-suffix`, and `external-id` attributes of import and export names as an unordered `<attribute>*` list, and the binary format accepts them in any order as well. The text parser, however, only accepted them in the fixed order of `implements`, `version-suffix`, then `external-id`, and anything else failed with an unhelpful "unexpected token" error pointing at the out-of-order attribute. This updates `ComponentExternName`'s parser, which is shared by imports, exports, inline instance exports, and component/instance type declarations, to accept these attributes in any order. Specifying the same attribute more than once is still rejected, but now with an explicit "duplicate `...` attribute" error pointing at the offending attribute. Printing is unchanged and continues to emit attributes in a canonical order.
jrandolf
force-pushed
the
wast-attribute-order
branch
from
October 21, 2026 18:13
e17e03a to
2e93d18
Compare
alexcrichton
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text format allows the attributes on import and export names (
implements,version-suffixandexternal-id) in any order, and so does the binary format. Thewastparser, however, only accepted them in one fixed order and otherwise failed with an "unexpected token" error. This accepts any order. Repeating an attribute is still an error, now with a "duplicate...attribute" message. Printing still uses the canonical order.