FastScriptReload
FastScriptReload copied to clipboard
The BuilderPatternFunctionsRewriter class has some incorrect handling methods.
orgin code is: ` private static ClassA staicField;
public static ClassA GetStaicField()
{
return staicField;
}`
will be written to ` private static ClassA staicField;
public static ClassA_Patched_0 GetStaicField()
{
return staicField;
}`
The above code may lead to type mismatch errors.
Only "return this" needs to be rewrite. Perhaps it is necessary to add a check for whether there is a "return this".
static bool ReturnsThis(MethodDeclarationSyntax method)
{
var returnStatements = method.DescendantNodes().OfType<ReturnStatementSyntax>();
return returnStatements.All(r => r.Expression is ThisExpressionSyntax);
}
Thanks - I'll try to have a look, btw if you already have a fix ready it'd be great to have that as PR.
I think rewritter you want is here FastScriptReload.Editor.Compilation.CodeRewriting.BuilderPatternFunctionsRewriter.BuilderPatternFunctionsRewriter