How to reference extension methods in macro generated code? #55672
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
feature-macros
Implementation of the macros feature
pkg-macros
The experimental package:_macros library
Extension methods don't map well to the
Identifier
abstraction as it exists today. In general I think to emit code which calls an extension method you would have to wrap the receiver in the extension (MyExtension(receiver)
) and then call the extension method on that (maybe by name, not sure an identifier of the extension method would work).In general this wrapping is necessary to eliminate ambiguity from generated augmentations, but it would be ideal if we could automatically do the wrapping for you. So for instance, you would just use the identifier for an extension method in the same way you would use an identifier to an instance method, and we would perform the wrapping for you:
Would become:
The text was updated successfully, but these errors were encountered: