Skip to content

Commit 7c7927c

Browse files
Support returning tuples in extract method when ref/out are not possible. (#76383)
2 parents fba9ef6 + 1f93a72 commit 7c7927c

File tree

10 files changed

+946
-386
lines changed

10 files changed

+946
-386
lines changed

src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ protected static async Task TestExtractMethodAsync(
7979
[StringSyntax(PredefinedEmbeddedLanguageNames.CSharpTest)] string codeWithMarker,
8080
[StringSyntax(PredefinedEmbeddedLanguageNames.CSharpTest)] string expected,
8181
bool temporaryFailing = false,
82-
CSharpParseOptions parseOptions = null)
82+
CSharpParseOptions parseOptions = null,
83+
bool localFunction = false)
8384
{
8485
using var workspace = EditorTestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);
8586
var testDocument = workspace.Documents.Single();
8687
var subjectBuffer = testDocument.GetTextBuffer();
8788

8889
var tree = await ExtractMethodAsync(
89-
workspace, testDocument);
90+
workspace, testDocument, localFunction: localFunction);
9091

9192
using (var edit = subjectBuffer.CreateEdit())
9293
{
@@ -116,7 +117,8 @@ protected static async Task TestExtractMethodAsync(
116117
protected static async Task<SyntaxNode> ExtractMethodAsync(
117118
EditorTestWorkspace workspace,
118119
EditorTestHostDocument testDocument,
119-
bool succeed = true)
120+
bool succeed = true,
121+
bool localFunction = false)
120122
{
121123
var document = workspace.CurrentSolution.GetDocument(testDocument.Id);
122124
Assert.NotNull(document);
@@ -137,7 +139,7 @@ protected static async Task<SyntaxNode> ExtractMethodAsync(
137139
Assert.NotNull(selectedCode);
138140

139141
// extract method
140-
var extractor = new CSharpMethodExtractor(selectedCode, options, localFunction: false);
142+
var extractor = new CSharpMethodExtractor(selectedCode, options, localFunction);
141143
var result = extractor.ExtractMethod(status, CancellationToken.None);
142144
Assert.NotNull(result);
143145

0 commit comments

Comments
 (0)