File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Orm/Xtensive.Orm/Sql/Compiler/Internals/Nodes Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ internal override void AcceptVisitor(NodeVisitor visitor)
164164 internal void FlushBuffer ( )
165165 {
166166 if ( stringBuilder . Length > 0 ) {
167- children . Add ( new TextNode ( stringBuilder . ToString ( ) ) ) ;
167+ children . Add ( TextNode . Create ( stringBuilder . ToString ( ) ) ) ;
168168 lastNodeIsText = true ;
169169 lastChar = stringBuilder [ ^ 1 ] ;
170170 _ = stringBuilder . Clear ( ) ;
Original file line number Diff line number Diff line change @@ -9,19 +9,30 @@ namespace Xtensive.Sql.Compiler
99 [ DebuggerDisplay ( "Text = {Text}" ) ]
1010 internal class TextNode : Node
1111 {
12+ private const string CommaString = ", " ;
13+ private static readonly TextNode CommaNode = new TextNode ( CommaString ) ;
14+
1215 public readonly string Text ;
1316
14- internal override void AcceptVisitor ( NodeVisitor visitor )
17+ public static TextNode Create ( string text )
1518 {
16- visitor . Visit ( this ) ;
19+ if ( text . Length < 3 ) {
20+ text = string . Intern ( text ) ;
21+ if ( text == CommaString ) {
22+ return CommaNode ;
23+ }
24+ }
25+ return new TextNode ( text ) ;
1726 }
1827
28+ internal override void AcceptVisitor ( NodeVisitor visitor ) => visitor . Visit ( this ) ;
29+
1930 // Constructor
2031
21- public TextNode ( string text )
32+ private TextNode ( string text )
2233 : base ( true )
2334 {
2435 Text = text ;
2536 }
2637 }
27- }
38+ }
You can’t perform that action at this time.
0 commit comments