From 3ccc248ccd2871434a5fe627384765ccc80d86c6 Mon Sep 17 00:00:00 2001 From: bernd Date: Thu, 22 May 2025 13:40:01 +0200 Subject: [PATCH] avoid not needed compilationUnit clone --- src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs index c7c3d656049b5..6cf328da50821 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxTree.cs @@ -515,7 +515,9 @@ public static SyntaxTree ParseText( compilationUnit, parser.Directives, diagnosticOptions: diagnosticOptions, - cloneRoot: true); + cloneRoot: false); + Debug.Assert(compilationUnit._syntaxTree == null); + compilationUnit._syntaxTree = tree; tree.VerifySource(); return tree; }