提交 042461b9 编写于 作者: P pgavlin

Addressing CR feedback for C1396847. (changeset 1396967)

上级 7cf4f47c
...@@ -80,7 +80,7 @@ internal new SyntaxTree SyntaxTree ...@@ -80,7 +80,7 @@ internal new SyntaxTree SyntaxTree
private static void ComputeSyntaxTree(CSharpSyntaxNode node) private static void ComputeSyntaxTree(CSharpSyntaxNode node)
{ {
List<CSharpSyntaxNode> nodes = null; ArrayBuilder<CSharpSyntaxNode> nodes = null;
SyntaxTree tree = null; SyntaxTree tree = null;
// Find the nearest parent with a non-null syntax tree // Find the nearest parent with a non-null syntax tree
...@@ -107,7 +107,7 @@ private static void ComputeSyntaxTree(CSharpSyntaxNode node) ...@@ -107,7 +107,7 @@ private static void ComputeSyntaxTree(CSharpSyntaxNode node)
} }
else else
{ {
(nodes ?? (nodes = new List<CSharpSyntaxNode>())).Add(node); (nodes ?? (nodes = ArrayBuilder<CSharpSyntaxNode>.GetInstance())).Add(node);
node = parent; node = parent;
} }
} }
...@@ -125,6 +125,8 @@ private static void ComputeSyntaxTree(CSharpSyntaxNode node) ...@@ -125,6 +125,8 @@ private static void ComputeSyntaxTree(CSharpSyntaxNode node)
tree = existingTree; tree = existingTree;
} }
} }
nodes.Free();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册