Skip to content

Commit a5e8623

Browse files
committed
Add IsSearchable property to tokens.
This allows us to avoid searching for certain tokens such as locals and function parameters.
1 parent 1c4ead4 commit a5e8623

File tree

1 file changed

+7
-3
lines changed
  • src/SourceBrowser.Generator/Model

1 file changed

+7
-3
lines changed

src/SourceBrowser.Generator/Model/Token.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,31 @@ public class Token
2424

2525
public bool IsDeclaration { get; }
2626

27+
public bool IsSearchable { get; }
28+
2729
public DocumentModel Document { get; }
2830

29-
public Token(DocumentModel document, string fullName, string value, string type, int lineNumber, bool isDeclaration = false)
31+
public Token(DocumentModel document, string fullName, string value, string type, int lineNumber, bool isDeclaration = false, bool isSearchable = false)
3032
{
3133
Document = document;
3234
FullName = fullName;
3335
Value = value;
3436
Type = type;
3537
LineNumber = lineNumber;
3638
IsDeclaration = isDeclaration;
39+
IsSearchable = isSearchable;
3740
}
3841

39-
private Token(Token oldToken, ILink link) : this(oldToken.Document, oldToken.FullName, oldToken.Value, oldToken.Type, oldToken.LineNumber, oldToken.IsDeclaration)
42+
private Token(Token oldToken, ILink link) :
43+
this(oldToken.Document, oldToken.FullName, oldToken.Value, oldToken.Type, oldToken.LineNumber, oldToken.IsDeclaration, oldToken.IsSearchable)
4044
{
4145
Link = link;
4246
LeadingTrivia = oldToken.LeadingTrivia;
4347
TrailingTrivia = oldToken.TrailingTrivia;
4448
}
4549

4650
private Token(Token oldToken, ICollection<Trivia> leading, ICollection<Trivia> trailing) :
47-
this(oldToken.Document, oldToken.FullName, oldToken.Value, oldToken.Type, oldToken.LineNumber, oldToken.IsDeclaration)
51+
this(oldToken.Document, oldToken.FullName, oldToken.Value, oldToken.Type, oldToken.LineNumber, oldToken.IsDeclaration, oldToken.IsSearchable)
4852
{
4953
Link = oldToken.Link;
5054
LeadingTrivia = leading;

0 commit comments

Comments
 (0)