Skip to content

Port MakeLocalFunctionStatic analyzer and tests to shared layer#43061

Merged
3 commits merged intodotnet:masterfrom
mavasani:MakeLocalFunctionStatic
Apr 3, 2020
Merged

Port MakeLocalFunctionStatic analyzer and tests to shared layer#43061
3 commits merged intodotnet:masterfrom
mavasani:MakeLocalFunctionStatic

Conversation

@mavasani
Copy link
Contributor

@mavasani mavasani commented Apr 3, 2020

First commit: File moves
Second commit: xlf and resx changes
Third commit: Revert some unintentional changes to fixer

mavasani added 3 commits April 3, 2020 13:07
CodeFix has not yet been ported because it depends on internal CodeGenerationSymbolFactory APIs. dotnet#43056 tracks making these APIs public and subsequently porting the fixer. To enable porting the tests, I have added a workaround in CodeStyle layer test framework to use the IDE code fixer with the CodeStyle layer analyzer for tests.
@mavasani mavasani added this to the 16.6 milestone Apr 3, 2020
@mavasani mavasani requested review from a team and CyrusNajmabadi April 3, 2020 20:35

namespace Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic
{
internal static class MakeLocalFunctionStaticHelper
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Existing code just split into separate helper types for analyzer and fixer.

{
syntaxEditor.ReplaceNode(
identifierNode,
(node, generator) => generator.IdentifierName(parameter.Name.ToIdentifierToken()).WithTriviaFrom(node));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change in last commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunate if they have different behavior. i want your change here to be good :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests passed either way, just reverted as wasn't necessary.

}

return AddStaticModifier(localFunctionWithNewParameters, CSharpSyntaxGenerator.Instance);
return AddStaticModifier(localFunctionWithNewParameters, SyntaxGenerator.GetGenerator(document));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change in last commit.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

@ghost ghost merged commit f274286 into dotnet:master Apr 3, 2020
@mavasani mavasani deleted the MakeLocalFunctionStatic branch April 4, 2020 00:01
@jinujoseph jinujoseph modified the milestones: 16.6, 16.6.P3 Apr 4, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants