Beef icon indicating copy to clipboard operation
Beef copied to clipboard

Allow code emitted for extension to call methods from the project extending it

Open RogueMacro opened this issue 3 years ago • 0 comments

I want to be able to do

// namespace MyProject

[GenerateAMethod]
extension SomeClass
{
    // Doesn't work because MyProject isn't available from the project that contains SomeClass
    // Since extensions can use code from MyProject so should the generated code, right?

    // I want to generate something like this
    public MyProject.Data GetData() { ... }
}

struct GenerateAMethodAttribute : Attribute, IComptimeTypeApply
{
    // Will generate a method as shown above
}

I found out it only emits code if the type being extended has the [Reflect] attribute.

RogueMacro avatar Jun 05 '21 22:06 RogueMacro