Skip to content

Implement module/component alias sugar when instantiating#627

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:more-sugar
Jun 8, 2022
Merged

Implement module/component alias sugar when instantiating#627
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:more-sugar

Conversation

@alexcrichton
Copy link
Member

The syntax for instantiation changed slightly in #621 where a bare index
is now required, but this syntax prevents the inline injection and usage
of an alias of an export of another component/instance. This commit
soups up the support here by bringing back the IndexOrRef structure
which can be used to parse one of the two, allowing both a bare
reference plus a parenthesized reference that enables alias injection.

The syntax for instantiation changed slightly in bytecodealliance#621 where a bare index
is now required, but this syntax prevents the inline injection and usage
of an alias of an export of another component/instance. This commit
soups up the support here by bringing back the `IndexOrRef` structure
which can be used to parse one of the two, allowing both a bare
reference plus a parenthesized reference that enables alias injection.
@alexcrichton alexcrichton requested a review from peterhuene June 8, 2022 15:47
Copy link
Member

@peterhuene peterhuene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks for fixing this! Hopefully there weren't other places where I was a little too literal with the spec interpretation.

@alexcrichton
Copy link
Member Author

I grepped around and we're not using the Index<'a> field in too many places so I think we should be good, but I think it's fine to fix these on a case-by-case basis as well.

@alexcrichton alexcrichton merged commit 010e030 into bytecodealliance:main Jun 8, 2022
@alexcrichton alexcrichton deleted the more-sugar branch June 8, 2022 18:03
code-terror pushed a commit to code-terror/wasm-tools that referenced this pull request Aug 24, 2022
…liance#627)

The syntax for instantiation changed slightly in bytecodealliance#621 where a bare index
is now required, but this syntax prevents the inline injection and usage
of an alias of an export of another component/instance. This commit
soups up the support here by bringing back the `IndexOrRef` structure
which can be used to parse one of the two, allowing both a bare
reference plus a parenthesized reference that enables alias injection.
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.

2 participants