Testura/Testura.Code

support for OperatorDeclarationSyntax

Closed this issue · 5 comments

is it possible to generate static bool operator == operations in a class?

Hey,

Sadly I haven't implemented override of operators yet. But I can look at it if it's something that you need?

yes, please. need it for completeness of IEquatable implementation

I have uploaded a new version (0.17.0) that hopefully have what you are looking for. You simply specify it when creating the method. For example:

var method = new MethodBuilder("MyMethod")
                .WithModifiers(Modifiers.Public, Modifiers.Static)
                .WithOperatorOverloading(Operators.Equal)
                .WithBody(BodyGenerator.Create())
               .Build();

It should give you:

public static MyMethod operator ==() { }

thank you :)

worked perfectly.