File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
Orm/Xtensive.Orm/Sql/Compiler/Internals/Nodes Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -164,11 +164,7 @@ internal override void AcceptVisitor(NodeVisitor visitor)
164164 internal void FlushBuffer ( )
165165 {
166166 if ( stringBuilder . Length > 0 ) {
167- var s = stringBuilder . ToString ( ) ;
168- if ( s . Length < 3 ) {
169- s = string . Intern ( s ) ;
170- }
171- children . Add ( new TextNode ( s ) ) ;
167+ children . Add ( TextNode . Create ( stringBuilder . ToString ( ) ) ) ;
172168 lastNodeIsText = true ;
173169 lastChar = stringBuilder [ ^ 1 ] ;
174170 _ = 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+ internal override void AcceptVisitor ( NodeVisitor visitor ) => visitor . Visit ( this ) ;
18+
19+ public static TextNode Create ( string text )
1520 {
16- visitor . Visit ( this ) ;
21+ if ( text . Length < 3 ) {
22+ text = string . Intern ( text ) ;
23+ if ( text == CommaString ) {
24+ return CommaNode ;
25+ }
26+ }
27+ return new TextNode ( text ) ;
1728 }
1829
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