Skip to content

Replace all Self identifiers in method argument and return types#4155

Merged
daxpedda merged 9 commits intowasm-bindgen:mainfrom
RunDevelopment:self-methods
Oct 10, 2024
Merged

Replace all Self identifiers in method argument and return types#4155
daxpedda merged 9 commits intowasm-bindgen:mainfrom
RunDevelopment:self-methods

Conversation

@RunDevelopment
Copy link
Copy Markdown
Contributor

@RunDevelopment RunDevelopment commented Oct 9, 2024

fixes #3105
closes #3631

This PR is based on #3631 by @snOm3ad. I looked at it to see what needed to be changed and that I stole tests from there. I tagged @snOm3ad as the co-author in one commit, but (speaking to the maintainer) please also tag them in the merge commit of this PR in case GH doesn't.

The main approach of this PR is different from #3631. I used syn's mut visitor to replace all Self identifiers with the identifier for the type. This makes the code very simple and guarantees that no occurrences of Self are left.

Copy link
Copy Markdown
Member

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

I would appreciate if you could leave some code comments here, I always have to spend non-trivial time digging into this when it comes up.

@daxpedda daxpedda added the waiting for author Waiting for author to respond label Oct 9, 2024
@RunDevelopment
Copy link
Copy Markdown
Contributor Author

I would appreciate if you could leave some code comments here, I always have to spend non-trivial time digging into this when it comes up.

Gladly. I assume that this is a general remark about my PRs and I will add some more code comments from now on.

Copy link
Copy Markdown
Member

@daxpedda daxpedda left a comment

Choose a reason for hiding this comment

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

Thank you!
(needs a rebase again)

@daxpedda daxpedda merged commit 0e89a29 into wasm-bindgen:main Oct 10, 2024
@RunDevelopment RunDevelopment deleted the self-methods branch October 10, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for author Waiting for author to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Returning Option<Self> in #[wasm_bindgen] impl block gives error

2 participants