@@ -19,10 +19,10 @@ public void AddComment(CommentLine comment)
19
19
}
20
20
21
21
// Comments sorted by location.
22
- private readonly SortedDictionary < Location , CommentLine > comments = new SortedDictionary < Location , CommentLine > ( new LocationComparer ( ) ) ;
22
+ private readonly SortedDictionary < Microsoft . CodeAnalysis . Location , CommentLine > comments = new SortedDictionary < Microsoft . CodeAnalysis . Location , CommentLine > ( new LocationComparer ( ) ) ;
23
23
24
24
// Program elements sorted by location.
25
- private readonly SortedDictionary < Location , Label > elements = new SortedDictionary < Location , Label > ( new LocationComparer ( ) ) ;
25
+ private readonly SortedDictionary < Microsoft . CodeAnalysis . Location , Label > elements = new SortedDictionary < Microsoft . CodeAnalysis . Location , Label > ( new LocationComparer ( ) ) ;
26
26
27
27
private readonly Dictionary < Label , Key > duplicationGuardKeys = new Dictionary < Label , Key > ( ) ;
28
28
@@ -33,9 +33,9 @@ public void AddComment(CommentLine comment)
33
33
return null ;
34
34
}
35
35
36
- private class LocationComparer : IComparer < Location >
36
+ private class LocationComparer : IComparer < Microsoft . CodeAnalysis . Location >
37
37
{
38
- public int Compare ( Location ? l1 , Location ? l2 ) => CommentProcessor . Compare ( l1 , l2 ) ;
38
+ public int Compare ( Microsoft . CodeAnalysis . Location ? l1 , Microsoft . CodeAnalysis . Location ? l2 ) => CommentProcessor . Compare ( l1 , l2 ) ;
39
39
}
40
40
41
41
/// <summary>
@@ -44,7 +44,7 @@ private class LocationComparer : IComparer<Location>
44
44
/// <param name="l1">First location</param>
45
45
/// <param name="l2">Second location</param>
46
46
/// <returns><0 if l1 before l2, >0 if l1 after l2, else 0.</returns>
47
- private static int Compare ( Location ? l1 , Location ? l2 )
47
+ private static int Compare ( Microsoft . CodeAnalysis . Location ? l1 , Microsoft . CodeAnalysis . Location ? l2 )
48
48
{
49
49
if ( object . ReferenceEquals ( l1 , l2 ) )
50
50
return 0 ;
@@ -68,7 +68,7 @@ private static int Compare(Location? l1, Location? l2)
68
68
/// <param name="elementLabel">The label of the element in the trap file.</param>
69
69
/// <param name="duplicationGuardKey">The duplication guard key of the element, if any.</param>
70
70
/// <param name="loc">The location of the element.</param>
71
- public void AddElement ( Label elementLabel , Key ? duplicationGuardKey , Location ? loc )
71
+ public void AddElement ( Label elementLabel , Key ? duplicationGuardKey , Microsoft . CodeAnalysis . Location ? loc )
72
72
{
73
73
if ( loc is not null && loc . IsInSource )
74
74
elements [ loc ] = elementLabel ;
@@ -78,7 +78,7 @@ public void AddElement(Label elementLabel, Key? duplicationGuardKey, Location? l
78
78
79
79
// Ensure that commentBlock and element refer to the same file
80
80
// which can happen when processing multiple files.
81
- private static void EnsureSameFile ( Comments . CommentBlock commentBlock , ref KeyValuePair < Location , Label > ? element )
81
+ private static void EnsureSameFile ( Comments . CommentBlock commentBlock , ref KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? element )
82
82
{
83
83
if ( element is not null && element . Value . Key . SourceTree != commentBlock . Location . SourceTree )
84
84
element = null ;
@@ -96,9 +96,9 @@ private static void EnsureSameFile(Comments.CommentBlock commentBlock, ref KeyVa
96
96
/// <param name="callback">Output binding information.</param>
97
97
private void GenerateBindings (
98
98
Comments . CommentBlock commentBlock ,
99
- KeyValuePair < Location , Label > ? previousElement ,
100
- KeyValuePair < Location , Label > ? nextElement ,
101
- KeyValuePair < Location , Label > ? parentElement ,
99
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? previousElement ,
100
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? nextElement ,
101
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? parentElement ,
102
102
CommentBindingCallback callback
103
103
)
104
104
{
@@ -125,7 +125,7 @@ CommentBindingCallback callback
125
125
}
126
126
127
127
// Heuristic to decide which is the "best" element associated with the comment.
128
- KeyValuePair < Location , Label > ? bestElement ;
128
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? bestElement ;
129
129
130
130
if ( previousElement is not null && previousElement . Value . Key . EndLine ( ) == commentBlock . Location . StartLine ( ) )
131
131
{
@@ -180,14 +180,14 @@ CommentBindingCallback callback
180
180
private class ElementStack
181
181
{
182
182
// Invariant: the top of the stack must be contained by items below it.
183
- private readonly Stack < KeyValuePair < Location , Label > > elementStack = new Stack < KeyValuePair < Location , Label > > ( ) ;
183
+ private readonly Stack < KeyValuePair < Microsoft . CodeAnalysis . Location , Label > > elementStack = new ( ) ;
184
184
185
185
/// <summary>
186
186
/// Add a new element to the stack.
187
187
/// </summary>
188
188
/// The stack is maintained.
189
189
/// <param name="value">The new element to push.</param>
190
- public void Push ( KeyValuePair < Location , Label > value )
190
+ public void Push ( KeyValuePair < Microsoft . CodeAnalysis . Location , Label > value )
191
191
{
192
192
// Maintain the invariant by popping existing elements
193
193
while ( elementStack . Count > 0 && ! elementStack . Peek ( ) . Key . Contains ( value . Key ) )
@@ -201,15 +201,15 @@ public void Push(KeyValuePair<Location, Label> value)
201
201
/// </summary>
202
202
/// <param name="l">The location of the comment.</param>
203
203
/// <returns>An element completely containing l, or null if none found.</returns>
204
- public KeyValuePair < Location , Label > ? FindParent ( Location l ) =>
204
+ public KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? FindParent ( Microsoft . CodeAnalysis . Location l ) =>
205
205
elementStack . Where ( v => v . Key . Contains ( l ) ) . FirstOrNull ( ) ;
206
206
207
207
/// <summary>
208
208
/// Finds the element on the stack immediately preceding the comment at l.
209
209
/// </summary>
210
210
/// <param name="l">The location of the comment.</param>
211
211
/// <returns>The element before l, or null.</returns>
212
- public KeyValuePair < Location , Label > ? FindBefore ( Location l )
212
+ public KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? FindBefore ( Microsoft . CodeAnalysis . Location l )
213
213
{
214
214
return elementStack
215
215
. Where ( v => v . Key . SourceSpan . End < l . SourceSpan . Start )
@@ -222,7 +222,7 @@ public void Push(KeyValuePair<Location, Label> value)
222
222
/// <param name="comment">The location of the comment.</param>
223
223
/// <param name="next">The next element.</param>
224
224
/// <returns>The next element.</returns>
225
- public KeyValuePair < Location , Label > ? FindAfter ( Location comment , KeyValuePair < Location , Label > ? next )
225
+ public KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? FindAfter ( Microsoft . CodeAnalysis . Location comment , KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? next )
226
226
{
227
227
var p = FindParent ( comment ) ;
228
228
return next . HasValue && p . HasValue && p . Value . Key . Before ( next . Value . Key ) ? null : next ;
@@ -233,7 +233,7 @@ public void Push(KeyValuePair<Location, Label> value)
233
233
private void GenerateBindings (
234
234
Comments . CommentBlock block ,
235
235
ElementStack elementStack ,
236
- KeyValuePair < Location , Label > ? nextElement ,
236
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? nextElement ,
237
237
CommentBindingCallback cb
238
238
)
239
239
{
@@ -259,8 +259,8 @@ CommentBindingCallback cb
259
259
/// <param name="cb">Where to send the results.</param>
260
260
/// <returns>true if there are more comments to process, false otherwise.</returns>
261
261
private bool GenerateBindings (
262
- IEnumerator < KeyValuePair < Location , CommentLine > > commentEnumerator ,
263
- KeyValuePair < Location , Label > ? nextElement ,
262
+ IEnumerator < KeyValuePair < Microsoft . CodeAnalysis . Location , CommentLine > > commentEnumerator ,
263
+ KeyValuePair < Microsoft . CodeAnalysis . Location , Label > ? nextElement ,
264
264
ElementStack elementStack ,
265
265
CommentBindingCallback cb
266
266
)
@@ -319,8 +319,8 @@ public void GenerateBindings(CommentBindingCallback cb)
319
319
320
320
var elementStack = new ElementStack ( ) ;
321
321
322
- using IEnumerator < KeyValuePair < Location , Label > > elementEnumerator = elements . GetEnumerator ( ) ;
323
- using IEnumerator < KeyValuePair < Location , CommentLine > > commentEnumerator = comments . GetEnumerator ( ) ;
322
+ using IEnumerator < KeyValuePair < Microsoft . CodeAnalysis . Location , Label > > elementEnumerator = elements . GetEnumerator ( ) ;
323
+ using IEnumerator < KeyValuePair < Microsoft . CodeAnalysis . Location , CommentLine > > commentEnumerator = comments . GetEnumerator ( ) ;
324
324
if ( ! commentEnumerator . MoveNext ( ) )
325
325
{
326
326
// There are no comments to process.
0 commit comments