Skip to content

Commit d7a4515

Browse files
Make SyntaxUtilities.MergeTextLiterals private
This method is no longer used outside of SyntaxUtilities.
1 parent a71697f commit d7a4515

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxUtilities.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax;
99

1010
internal static class SyntaxUtilities
1111
{
12-
public static MarkupTextLiteralSyntax MergeTextLiterals(params ReadOnlySpan<MarkupTextLiteralSyntax?> literals)
13-
{
14-
SyntaxNode? parent = null;
15-
var position = 0;
16-
var seenFirstLiteral = false;
17-
18-
using PooledArrayBuilder<SyntaxToken> builder = [];
19-
20-
foreach (var literal in literals)
21-
{
22-
if (literal == null)
23-
{
24-
continue;
25-
}
26-
27-
if (!seenFirstLiteral)
28-
{
29-
// Set the parent and position of the merged literal to the value of the first non-null literal.
30-
parent = literal.Parent;
31-
position = literal.Position;
32-
seenFirstLiteral = true;
33-
}
34-
35-
builder.AddRange(literal.LiteralTokens);
36-
}
37-
38-
return (MarkupTextLiteralSyntax)InternalSyntax.SyntaxFactory
39-
.MarkupTextLiteral(
40-
literalTokens: builder.ToGreenListNode().ToGreenList<InternalSyntax.SyntaxToken>(),
41-
chunkGenerator: null)
42-
.CreateRed(parent, position);
43-
}
44-
4512
internal static SyntaxList<RazorSyntaxNode> GetRewrittenMarkupStartTagChildren(
4613
MarkupStartTagSyntax node, bool includeEditHandler = false)
4714
{
@@ -120,6 +87,39 @@ void AddLiteralIsIfNeeded()
12087
}
12188
}
12289

90+
private static MarkupTextLiteralSyntax MergeTextLiterals(params ReadOnlySpan<MarkupTextLiteralSyntax?> literals)
91+
{
92+
SyntaxNode? parent = null;
93+
var position = 0;
94+
var seenFirstLiteral = false;
95+
96+
using PooledArrayBuilder<SyntaxToken> builder = [];
97+
98+
foreach (var literal in literals)
99+
{
100+
if (literal == null)
101+
{
102+
continue;
103+
}
104+
105+
if (!seenFirstLiteral)
106+
{
107+
// Set the parent and position of the merged literal to the value of the first non-null literal.
108+
parent = literal.Parent;
109+
position = literal.Position;
110+
seenFirstLiteral = true;
111+
}
112+
113+
builder.AddRange(literal.LiteralTokens);
114+
}
115+
116+
return (MarkupTextLiteralSyntax)InternalSyntax.SyntaxFactory
117+
.MarkupTextLiteral(
118+
literalTokens: builder.ToGreenListNode().ToGreenList<InternalSyntax.SyntaxToken>(),
119+
chunkGenerator: null)
120+
.CreateRed(parent, position);
121+
}
122+
123123
internal static SyntaxList<RazorSyntaxNode> GetRewrittenMarkupEndTagChildren(
124124
MarkupEndTagSyntax node, bool includeEditHandler = false)
125125
{

0 commit comments

Comments
 (0)