Skip to content

Commit

Permalink
Merge pull request #65716 from jasonmalinowski/delete-unnecessary-code
Browse files Browse the repository at this point in the history
Delete unnecessary code that was for recoverable trees
  • Loading branch information
jasonmalinowski authored Dec 2, 2022
2 parents ddb3db0 + 0fb9785 commit 4d07c7b
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,7 @@ private static async Task<TreeAndVersion> FullyParseTreeAsync(
using (Logger.LogBlock(FunctionId.Workspace_Document_State_FullyParseSyntaxTree, s_fullParseLog, filePath, mode, cancellationToken))
{
var textAndVersion = await newTextSource.GetValueAsync(loadTextOptions, cancellationToken).ConfigureAwait(false);
var treeAndVersion = CreateTreeAndVersion(filePath, options, languageServices, textAndVersion, cancellationToken);

// The tree may be a RecoverableSyntaxTree. In its initial state, the RecoverableSyntaxTree keeps a
// strong reference to the root SyntaxNode, and only transitions to a weak reference backed by temporary
// storage after the first time GetRoot (or GetRootAsync) is called. Since we know we are creating a
// RecoverableSyntaxTree for the purpose of avoiding problematic memory overhead, we call GetRoot
// immediately to force the object to weakly hold its data from the start.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1307180
await treeAndVersion.Tree.GetRootAsync(cancellationToken).ConfigureAwait(false);

return treeAndVersion;
return CreateTreeAndVersion(filePath, options, languageServices, textAndVersion, cancellationToken);
}
}

Expand All @@ -150,17 +140,7 @@ private static TreeAndVersion FullyParseTree(
using (Logger.LogBlock(FunctionId.Workspace_Document_State_FullyParseSyntaxTree, s_fullParseLog, filePath, mode, cancellationToken))
{
var textAndVersion = newTextSource.GetValue(loadTextOptions, cancellationToken);
var treeAndVersion = CreateTreeAndVersion(filePath, options, languageServices, textAndVersion, cancellationToken);

// The tree may be a RecoverableSyntaxTree. In its initial state, the RecoverableSyntaxTree keeps a
// strong reference to the root SyntaxNode, and only transitions to a weak reference backed by temporary
// storage after the first time GetRoot (or GetRootAsync) is called. Since we know we are creating a
// RecoverableSyntaxTree for the purpose of avoiding problematic memory overhead, we call GetRoot
// immediately to force the object to weakly hold its data from the start.
// https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1307180
treeAndVersion.Tree.GetRoot(cancellationToken);

return treeAndVersion;
return CreateTreeAndVersion(filePath, options, languageServices, textAndVersion, cancellationToken);
}
}

Expand Down

0 comments on commit 4d07c7b

Please sign in to comment.