handzlikchris / handzlikchris/FastScriptReload

The BuilderPatternFunctionsRewriter class has some incorrect handling methods.

Open
#145 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
2.2k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

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();

return returnStatements.All(r => r.Expression is ThisExpressionSyntax);
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the BuilderPatternFunctionsRewriter class and inspect how it handles method return types and return statements. Reproduce the shown static getter case, then verify that only methods returning this are rewritten and that the generated code has no type mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.