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

Restrict possible method calls on layout objects #439

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Restrict possible method calls on layout objects #439

merged 1 commit into from
Jan 27, 2024

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Jan 27, 2024

#438 allowed layout macros to parse any method call on a layout object, translated verbatim to a method call on the generated Visitor object. This is potentially undesirable (already .pack(hints) is translated to .pack(hints, storage) for some generated storage object and .map_all() adjusts macro expansion instead of translating to a method call). This PR adds direct support for parsing .align(hints) and removes support for translating method calls verbatim.

Note: all these method calls emulate methods available on widget objects. rust-analyzer appears to link .pack and .align to the emulated method of AdaptWidget instead of the actually-used method on Visitor (possibly a bug, but it's acceptable here). The .map_all() method is not linked to anything (not surprising since the macro does not expand it as a method call). Unfortunately rust-analyzer is not able to suggest any of these available methods.

@dhardy dhardy merged commit 1333b6f into master Jan 27, 2024
5 checks passed
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