Restrict possible method calls on layout objects #439
Merged
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.
#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 generatedstorage
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 ofAdaptWidget
instead of the actually-used method onVisitor
(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). Unfortunatelyrust-analyzer
is not able to suggest any of these available methods.