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

Call post_convert immediately following to_ir #111

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

hoodmane
Copy link
Member

@hoodmane hoodmane commented Oct 2, 2023

This uses a decorator to call post_convert after each call to to_ir so that it can't be forgotten. In order to allow subclasses to restrict the type of to_ir, we use a decorator (I originally tried a similar approach as with type.render_name but it doesn't work with the subclass type restrictions). Typing the decorator took a bit of trial and error, but the key thing is to say that the decorator doesn't change the type of the function.

This uses a decorator to call post_convert after each call to `to_ir` so that it
can't be forgotten. In order to allow subclasses to restrict the type of
`to_ir`, we use a decorator (I originally tried a similar approach as with
`type.render_name` but it doesn't work with the subclass type restrictions).
Typing the decorator took a bit of trial and error, but the key thing is to say
that the decorator doesn't change the type of the function.
@hoodmane hoodmane force-pushed the call-post-convert-after-to-ir branch from f87e05f to 493c12e Compare October 2, 2023 17:16
@hoodmane hoodmane changed the title This moves the call to post_convert to immediately following to_ir Call post_convert immediately following to_ir Oct 2, 2023
@hoodmane hoodmane merged commit a79be6c into pyodide:master Oct 2, 2023
3 checks passed
@hoodmane hoodmane deleted the call-post-convert-after-to-ir branch October 2, 2023 17:16
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.

1 participant