22using Microsoft . CodeAnalysis ;
33using Microsoft . CodeAnalysis . CSharp ;
44using Semmle . Extraction . Entities ;
5- using System ;
65
76namespace Semmle . Extraction . CSharp . Entities
87{
98 class CommentLine : CachedEntity < ( Microsoft . CodeAnalysis . Location , string ) > , ICommentLine
109 {
11- CommentLine ( Context cx , Microsoft . CodeAnalysis . Location loc , CommentType type , string text , string raw )
10+ CommentLine ( Context cx , Microsoft . CodeAnalysis . Location loc , CommentLineType type , string text , string raw )
1211 : base ( cx , ( loc , text ) )
1312 {
1413 Type = type ;
1514 RawText = raw ;
1615 }
1716
1817 public Microsoft . CodeAnalysis . Location Location => symbol . Item1 ;
19- public CommentType Type { get ; private set ; }
18+ public CommentLineType Type { get ; private set ; }
2019
2120 public string Text { get { return symbol . Item2 ; } }
2221 public string RawText { get ; private set ; }
@@ -53,7 +52,7 @@ So split it up.
5352
5453 var span = Microsoft . CodeAnalysis . Text . TextSpan . FromBounds ( currentLocation , currentLocation + fullLine . Length ) ;
5554 var location = Microsoft . CodeAnalysis . Location . Create ( trivia . SyntaxTree , span ) ;
56- var commentType = CommentType . XmlDoc ;
55+ var commentType = CommentLineType . XmlDoc ;
5756 cx . CommentGenerator . AddComment ( Create ( cx , location , commentType , trimmedLine , fullLine ) ) ;
5857 }
5958 else
@@ -67,10 +66,10 @@ So split it up.
6766 case SyntaxKind . SingleLineCommentTrivia :
6867 {
6968 string contents = trivia . ToString ( ) . Substring ( 2 ) ;
70- var commentType = CommentType . Singleline ;
69+ var commentType = CommentLineType . Singleline ;
7170 if ( contents . Length > 0 && contents [ 0 ] == '/' )
7271 {
73- commentType = CommentType . XmlDoc ;
72+ commentType = CommentLineType . XmlDoc ;
7473 contents = contents . Substring ( 1 ) ; // An XML comment.
7574 }
7675 cx . CommentGenerator . AddComment ( Create ( cx , trivia . GetLocation ( ) , commentType , contents . Trim ( ) , trivia . ToFullString ( ) ) ) ;
@@ -98,7 +97,7 @@ So we split it into separate lines
9897
9998 var span = Microsoft . CodeAnalysis . Text . TextSpan . FromBounds ( currentLocation , currentLocation + fullLine . Length ) ;
10099 var location = Microsoft . CodeAnalysis . Location . Create ( trivia . SyntaxTree , span ) ;
101- var commentType = line == 0 ? CommentType . Multiline : CommentType . MultilineContinuation ;
100+ var commentType = line == 0 ? CommentLineType . Multiline : CommentLineType . MultilineContinuation ;
102101 cx . CommentGenerator . AddComment ( Create ( cx , location , commentType , trimmedLine , fullLine ) ) ;
103102 currentLocation = nextLineLocation ;
104103 }
@@ -115,7 +114,7 @@ So we split it into separate lines
115114 public override void Populate ( )
116115 {
117116 location = Context . Create ( Location ) ;
118- Context . Emit ( Tuples . commentline ( this , Type == CommentType . MultilineContinuation ? CommentType . Multiline : Type , Text , RawText ) ) ;
117+ Context . Emit ( Tuples . commentline ( this , Type == CommentLineType . MultilineContinuation ? CommentLineType . Multiline : Type , Text , RawText ) ) ;
119118 Context . Emit ( Tuples . commentline_location ( this , location ) ) ;
120119 }
121120
@@ -132,13 +131,13 @@ public override IId Id
132131 }
133132 }
134133
135- static CommentLine Create ( Context cx , Microsoft . CodeAnalysis . Location loc , CommentType type , string text , string raw ) => CommentLineFactory . Instance . CreateEntity ( cx , loc , type , text , raw ) ;
134+ static CommentLine Create ( Context cx , Microsoft . CodeAnalysis . Location loc , CommentLineType type , string text , string raw ) => CommentLineFactory . Instance . CreateEntity ( cx , loc , type , text , raw ) ;
136135
137- class CommentLineFactory : ICachedEntityFactory < ( Microsoft . CodeAnalysis . Location , CommentType , string , string ) , CommentLine >
136+ class CommentLineFactory : ICachedEntityFactory < ( Microsoft . CodeAnalysis . Location , CommentLineType , string , string ) , CommentLine >
138137 {
139138 public static readonly CommentLineFactory Instance = new CommentLineFactory ( ) ;
140139
141- public CommentLine Create ( Context cx , ( Microsoft . CodeAnalysis . Location , CommentType , string , string ) init ) =>
140+ public CommentLine Create ( Context cx , ( Microsoft . CodeAnalysis . Location , CommentLineType , string , string ) init ) =>
142141 new CommentLine ( cx , init . Item1 , init . Item2 , init . Item3 , init . Item4 ) ;
143142 }
144143
0 commit comments