@@ -9,39 +9,6 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax;
9
9
10
10
internal static class SyntaxUtilities
11
11
{
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
-
45
12
internal static SyntaxList < RazorSyntaxNode > GetRewrittenMarkupStartTagChildren (
46
13
MarkupStartTagSyntax node , bool includeEditHandler = false )
47
14
{
@@ -120,6 +87,39 @@ void AddLiteralIsIfNeeded()
120
87
}
121
88
}
122
89
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
+
123
123
internal static SyntaxList < RazorSyntaxNode > GetRewrittenMarkupEndTagChildren (
124
124
MarkupEndTagSyntax node , bool includeEditHandler = false )
125
125
{
0 commit comments