提交 d1379c69 编写于 作者: C CyrusNajmabadi

Pass around string table directly.

上级 aecf1da6
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
......@@ -14,10 +15,12 @@
namespace Microsoft.CodeAnalysis.CSharp.FindSymbols
{
using StringTable = ConcurrentDictionary<string, string>;
[ExportLanguageService(typeof(IDeclaredSymbolInfoFactoryService), LanguageNames.CSharp), Shared]
internal class CSharpDeclaredSymbolInfoFactoryService : AbstractDeclaredSymbolInfoFactoryService
{
private ImmutableArray<string> GetInheritanceNames(Project project, BaseListSyntax baseList)
private ImmutableArray<string> GetInheritanceNames(StringTable stringTable, BaseListSyntax baseList)
{
if (baseList == null)
{
......@@ -54,7 +57,7 @@ private ImmutableArray<string> GetInheritanceNames(Project project, BaseListSynt
AddInheritanceName(builder, baseType.Type, aliasMaps);
}
DeclaredSymbolInfo.Intern(project, builder);
Intern(stringTable, builder);
return builder.ToImmutableAndFree();
}
finally
......@@ -132,14 +135,14 @@ private void ProcessUsings(List<Dictionary<string, string>> aliasMaps, SyntaxLis
}
}
public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo)
public override bool TryGetDeclaredSymbolInfo(StringTable stringTable, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo)
{
switch (node.Kind())
{
case SyntaxKind.ClassDeclaration:
var classDecl = (ClassDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
classDecl.Identifier.ValueText,
GetTypeParameterSuffix(classDecl.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -147,12 +150,12 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
DeclaredSymbolInfoKind.Class,
GetAccessibility(classDecl, classDecl.Modifiers),
classDecl.Identifier.Span,
GetInheritanceNames(project, classDecl.BaseList));
GetInheritanceNames(stringTable, classDecl.BaseList));
return true;
case SyntaxKind.ConstructorDeclaration:
var ctorDecl = (ConstructorDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
ctorDecl.Identifier.ValueText,
GetConstructorSuffix(ctorDecl),
GetContainerDisplayName(node.Parent),
......@@ -166,7 +169,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.DelegateDeclaration:
var delegateDecl = (DelegateDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
delegateDecl.Identifier.ValueText,
GetTypeParameterSuffix(delegateDecl.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -179,7 +182,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.EnumDeclaration:
var enumDecl = (EnumDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
enumDecl.Identifier.ValueText, null,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -191,7 +194,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.EnumMemberDeclaration:
var enumMember = (EnumMemberDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
enumMember.Identifier.ValueText, null,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -203,7 +206,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.EventDeclaration:
var eventDecl = (EventDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
eventDecl.Identifier.ValueText, null,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -215,7 +218,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.IndexerDeclaration:
var indexerDecl = (IndexerDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
"this", GetIndexerSuffix(indexerDecl),
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -227,19 +230,19 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.InterfaceDeclaration:
var interfaceDecl = (InterfaceDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
interfaceDecl.Identifier.ValueText, GetTypeParameterSuffix(interfaceDecl.TypeParameterList),
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
DeclaredSymbolInfoKind.Interface,
GetAccessibility(interfaceDecl, interfaceDecl.Modifiers),
interfaceDecl.Identifier.Span,
GetInheritanceNames(project, interfaceDecl.BaseList));
GetInheritanceNames(stringTable, interfaceDecl.BaseList));
return true;
case SyntaxKind.MethodDeclaration:
var method = (MethodDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
method.Identifier.ValueText, GetMethodSuffix(method),
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -253,7 +256,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.PropertyDeclaration:
var property = (PropertyDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
property.Identifier.ValueText, null,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -265,14 +268,14 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
case SyntaxKind.StructDeclaration:
var structDecl = (StructDeclarationSyntax)node;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
structDecl.Identifier.ValueText, GetTypeParameterSuffix(structDecl.TypeParameterList),
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
DeclaredSymbolInfoKind.Struct,
GetAccessibility(structDecl, structDecl.Modifiers),
structDecl.Identifier.Span,
GetInheritanceNames(project, structDecl.BaseList));
GetInheritanceNames(stringTable, structDecl.BaseList));
return true;
case SyntaxKind.VariableDeclarator:
// could either be part of a field declaration or an event field declaration
......@@ -288,7 +291,7 @@ public override bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node,
: DeclaredSymbolInfoKind.Field;
declaredSymbolInfo = new DeclaredSymbolInfo(
project,
stringTable,
variableDeclarator.Identifier.ValueText, null,
GetContainerDisplayName(fieldDeclaration.Parent),
GetFullyQualifiedContainerName(fieldDeclaration.Parent),
......
......@@ -3,8 +3,6 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ErrorReporting;
......@@ -13,6 +11,8 @@
namespace Microsoft.CodeAnalysis.FindSymbols
{
using StringTable = ConcurrentDictionary<string, string>;
internal enum DeclaredSymbolInfoKind : byte
{
Class,
......@@ -82,11 +82,8 @@ internal struct DeclaredSymbolInfo
/// </summary>
public ImmutableArray<string> InheritanceNames { get; }
private static readonly ConditionalWeakTable<Project, ConcurrentDictionary<string, string>> s_projectStringTable =
new ConditionalWeakTable<Project, ConcurrentDictionary<string, string>>();
public DeclaredSymbolInfo(
Project project,
StringTable stringTable,
string name,
string nameSuffix,
string containerDisplayName,
......@@ -97,7 +94,6 @@ internal struct DeclaredSymbolInfo
ImmutableArray<string> inheritanceNames,
int parameterCount = 0, int typeParameterCount = 0)
{
var stringTable = s_projectStringTable.GetOrCreateValue(project);
Name = Intern(stringTable, name);
NameSuffix = Intern(stringTable, nameSuffix);
ContainerDisplayName = Intern(stringTable, containerDisplayName);
......@@ -114,18 +110,9 @@ internal struct DeclaredSymbolInfo
_flags = (uint)kind | ((uint)accessibility << 4) | ((uint)parameterCount << 8) | ((uint)typeParameterCount << 12);
}
public static string Intern(ConcurrentDictionary<string, string> stringTable, string name)
public static string Intern(StringTable stringTable, string name)
=> stringTable.GetOrAdd(name, name);
public static void Intern(Project project, ArrayBuilder<string> builder)
{
var table = s_projectStringTable.GetOrCreateValue(project);
for (int i = 0, n = builder.Count; i < n; i++)
{
builder[i] = Intern(table, builder[i]);
}
}
private static DeclaredSymbolInfoKind GetKind(uint flags)
=> (DeclaredSymbolInfoKind)(flags & Lower4BitMask);
......@@ -155,7 +142,7 @@ internal void WriteTo(ObjectWriter writer)
}
}
internal static DeclaredSymbolInfo ReadFrom_ThrowsOnFailure(Project project, ObjectReader reader)
internal static DeclaredSymbolInfo ReadFrom_ThrowsOnFailure(StringTable stringTable, ObjectReader reader)
{
var name = reader.ReadString();
var nameSuffix = reader.ReadString();
......@@ -174,7 +161,7 @@ internal static DeclaredSymbolInfo ReadFrom_ThrowsOnFailure(Project project, Obj
var span = new TextSpan(spanStart, spanLength);
return new DeclaredSymbolInfo(
project,
stringTable,
name: name,
nameSuffix: nameSuffix,
containerDisplayName: containerDisplayName,
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Collections.Immutable;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.FindSymbols
{
using StringTable = ConcurrentDictionary<string, string>;
internal partial class SyntaxTreeIndex
{
private struct DeclarationInfo
......@@ -26,7 +29,7 @@ public void WriteTo(ObjectWriter writer)
}
}
public static DeclarationInfo? TryReadFrom(Project project, ObjectReader reader)
public static DeclarationInfo? TryReadFrom(StringTable stringTable, ObjectReader reader)
{
try
{
......@@ -34,7 +37,7 @@ public void WriteTo(ObjectWriter writer)
var builder = ImmutableArray.CreateBuilder<DeclaredSymbolInfo>(declaredSymbolCount);
for (int i = 0; i < declaredSymbolCount; i++)
{
builder.Add(DeclaredSymbolInfo.ReadFrom_ThrowsOnFailure(project, reader));
builder.Add(DeclaredSymbolInfo.ReadFrom_ThrowsOnFailure(stringTable, reader));
}
return new DeclarationInfo(builder.MoveToImmutable());
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.ErrorReporting;
......@@ -13,9 +15,11 @@
namespace Microsoft.CodeAnalysis.FindSymbols
{
using StringTable = ConcurrentDictionary<string, string>;
internal interface IDeclaredSymbolInfoFactoryService : ILanguageService
{
bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo);
bool TryGetDeclaredSymbolInfo(StringTable stringTable, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo);
}
internal sealed partial class SyntaxTreeIndex
......@@ -29,10 +33,24 @@ internal sealed partial class SyntaxTreeIndex
public static readonly ObjectPool<HashSet<long>> LongLiteralHashSetPool =
new ObjectPool<HashSet<long>>(() => new HashSet<long>(), 20);
/// <summary>
/// String interning table so that we can share many more strings in our DeclaredSymbolInfo
/// buckets. Keyed off a Project instance so that we share all these strings as we create
/// the or load the index items for this a specific Project. This helps as we will generally
/// be creating or loading all the index items for the documents in a Project at the same time.
/// Once this project is let go of (which happens with any solution change) then we'll dump
/// this string table. The table will have already served its purpose at that point and
/// doesn't need to be kept around further.
/// </summary>
private static readonly ConditionalWeakTable<Project, StringTable> s_projectStringTable =
new ConditionalWeakTable<Project, StringTable>();
private static async Task<SyntaxTreeIndex> CreateIndexAsync(
Document document, Checksum checksum, CancellationToken cancellationToken)
{
var project = document.Project;
var stringTable = GetStringTable(project);
var syntaxFacts = document.GetLanguageService<ISyntaxFactsService>();
var infoFactory = document.GetLanguageService<IDeclaredSymbolInfoFactoryService>();
var ignoreCase = syntaxFacts != null && !syntaxFacts.IsCaseSensitive;
......@@ -86,7 +104,7 @@ internal sealed partial class SyntaxTreeIndex
// the future then we know the problem lies in (2). If, however, the problem is really in
// TryGetDeclaredSymbolInfo, then this will at least prevent us from returning bad spans
// and will prevent the crash from occurring.
if (infoFactory.TryGetDeclaredSymbolInfo(project, node, out var declaredSymbolInfo))
if (infoFactory.TryGetDeclaredSymbolInfo(stringTable, node, out var declaredSymbolInfo))
{
if (root.FullSpan.Contains(declaredSymbolInfo.Span))
{
......@@ -194,6 +212,9 @@ internal sealed partial class SyntaxTreeIndex
}
}
private static StringTable GetStringTable(Project project)
=> s_projectStringTable.GetOrCreateValue(project);
private static void GetIdentifierSet(bool ignoreCase, out HashSet<string> identifiers, out HashSet<string> escapedIdentifiers)
{
if (ignoreCase)
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
......@@ -10,6 +11,8 @@
namespace Microsoft.CodeAnalysis.FindSymbols
{
using StringTable = ConcurrentDictionary<string, string>;
internal sealed partial class SyntaxTreeIndex : IObjectWritable
{
private const string PersistenceName = "<SyntaxTreeIndex>";
......@@ -53,7 +56,7 @@ private void WriteFormatAndChecksum(ObjectWriter writer, string formatVersion)
{
if (FormatAndChecksumMatches(reader, SerializationFormat, checksum))
{
return ReadFrom(document.Project, reader, checksum);
return ReadFrom(GetStringTable(document.Project), reader, checksum);
}
}
}
......@@ -155,12 +158,12 @@ public void WriteTo(ObjectWriter writer)
}
private static SyntaxTreeIndex ReadFrom(
Project project, ObjectReader reader, Checksum checksum)
StringTable stringTable, ObjectReader reader, Checksum checksum)
{
var literalInfo = LiteralInfo.TryReadFrom(reader);
var identifierInfo = IdentifierInfo.TryReadFrom(reader);
var contextInfo = ContextInfo.TryReadFrom(reader);
var declarationInfo = DeclarationInfo.TryReadFrom(project, reader);
var declarationInfo = DeclarationInfo.TryReadFrom(stringTable, reader);
if (literalInfo == null || identifierInfo == null || contextInfo == null || declarationInfo == null)
{
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
......@@ -15,6 +16,8 @@
namespace Microsoft.CodeAnalysis.LanguageServices
{
using StringTable = ConcurrentDictionary<string, string>;
internal abstract class AbstractDeclaredSymbolInfoFactoryService : IDeclaredSymbolInfoFactoryService
{
private readonly static ObjectPool<List<Dictionary<string, string>>> s_aliasMapListPool =
......@@ -70,7 +73,15 @@ protected static void AppendTokens(SyntaxNode node, StringBuilder builder)
}
}
public abstract bool TryGetDeclaredSymbolInfo(Project project, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo);
protected static void Intern(StringTable stringTable, ArrayBuilder<string> builder)
{
for (int i = 0, n = builder.Count; i < n; i++)
{
builder[i] = DeclaredSymbolInfo.Intern(stringTable, builder[i]);
}
}
public abstract bool TryGetDeclaredSymbolInfo(StringTable stringTable, SyntaxNode node, out DeclaredSymbolInfo declaredSymbolInfo);
}
internal abstract class AbstractSyntaxFactsService
......
......@@ -9,13 +9,14 @@ Imports Microsoft.CodeAnalysis.FindSymbols
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.LanguageServices
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports StringTable = System.Collections.Concurrent.ConcurrentDictionary(Of String, String)
Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
<ExportLanguageService(GetType(IDeclaredSymbolInfoFactoryService), LanguageNames.VisualBasic), [Shared]>
Friend Class VisualBasicDeclaredSymbolInfoFactoryService
Inherits AbstractDeclaredSymbolInfoFactoryService
Private Function GetInheritanceNames(project As Project, typeBlock As TypeBlockSyntax) As ImmutableArray(Of String)
Private Function GetInheritanceNames(stringTable As StringTable, typeBlock As TypeBlockSyntax) As ImmutableArray(Of String)
Dim builder = ArrayBuilder(Of String).GetInstance()
Dim aliasMap = GetAliasMap(typeBlock)
......@@ -28,7 +29,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
AddInheritanceNames(builder, implementsStatement.Types, aliasMap)
Next
DeclaredSymbolInfo.Intern(project, builder)
Intern(stringTable, builder)
Return builder.ToImmutableAndFree()
Finally
FreeAliasMap(aliasMap)
......@@ -105,12 +106,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Return VisualBasicSyntaxFactsService.Instance.GetDisplayName(node, DisplayNameOptions.IncludeNamespaces)
End Function
Public Overrides Function TryGetDeclaredSymbolInfo(project As Project, node As SyntaxNode, ByRef declaredSymbolInfo As DeclaredSymbolInfo) As Boolean
Public Overrides Function TryGetDeclaredSymbolInfo(stringTable As StringTable, node As SyntaxNode, ByRef declaredSymbolInfo As DeclaredSymbolInfo) As Boolean
Select Case node.Kind()
Case SyntaxKind.ClassBlock
Dim classDecl = CType(node, ClassBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
classDecl.ClassStatement.Identifier.ValueText,
GetTypeParameterSuffix(classDecl.ClassStatement.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -118,14 +119,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
DeclaredSymbolInfoKind.Class,
GetAccessibility(classDecl, classDecl.ClassStatement.Modifiers),
classDecl.ClassStatement.Identifier.Span,
GetInheritanceNames(project, classDecl))
GetInheritanceNames(stringTable, classDecl))
Return True
Case SyntaxKind.ConstructorBlock
Dim constructor = CType(node, ConstructorBlockSyntax)
Dim typeBlock = TryCast(constructor.Parent, TypeBlockSyntax)
If typeBlock IsNot Nothing Then
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
typeBlock.BlockStatement.Identifier.ValueText,
GetConstructorSuffix(constructor),
GetContainerDisplayName(node.Parent),
......@@ -141,7 +142,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.DelegateFunctionStatement, SyntaxKind.DelegateSubStatement
Dim delegateDecl = CType(node, DelegateStatementSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
delegateDecl.Identifier.ValueText,
GetTypeParameterSuffix(delegateDecl.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -154,7 +155,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.EnumBlock
Dim enumDecl = CType(node, EnumBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
enumDecl.EnumStatement.Identifier.ValueText, Nothing,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -166,7 +167,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.EnumMemberDeclaration
Dim enumMember = CType(node, EnumMemberDeclarationSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
enumMember.Identifier.ValueText, Nothing,
GetContainerDisplayName(node.Parent),
GetFullyQualifiedContainerName(node.Parent),
......@@ -180,7 +181,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Dim statementOrBlock = If(TypeOf node.Parent Is EventBlockSyntax, node.Parent, node)
Dim eventParent = statementOrBlock.Parent
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
eventDecl.Identifier.ValueText, Nothing,
GetContainerDisplayName(eventParent),
GetFullyQualifiedContainerName(eventParent),
......@@ -192,7 +193,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.FunctionBlock, SyntaxKind.SubBlock
Dim funcDecl = CType(node, MethodBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
funcDecl.SubOrFunctionStatement.Identifier.ValueText,
GetMethodSuffix(funcDecl),
GetContainerDisplayName(node.Parent),
......@@ -207,7 +208,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.InterfaceBlock
Dim interfaceDecl = CType(node, InterfaceBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
interfaceDecl.InterfaceStatement.Identifier.ValueText,
GetTypeParameterSuffix(interfaceDecl.InterfaceStatement.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -215,7 +216,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
DeclaredSymbolInfoKind.Interface,
GetAccessibility(interfaceDecl, interfaceDecl.InterfaceStatement.Modifiers),
interfaceDecl.InterfaceStatement.Identifier.Span,
GetInheritanceNames(project, interfaceDecl))
GetInheritanceNames(stringTable, interfaceDecl))
Return True
Case SyntaxKind.ModifiedIdentifier
Dim modifiedIdentifier = CType(node, ModifiedIdentifierSyntax)
......@@ -226,7 +227,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
DeclaredSymbolInfoKind.Constant,
DeclaredSymbolInfoKind.Field)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
modifiedIdentifier.Identifier.ValueText, Nothing,
GetContainerDisplayName(fieldDecl.Parent),
GetFullyQualifiedContainerName(fieldDecl.Parent),
......@@ -238,7 +239,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.ModuleBlock
Dim moduleDecl = CType(node, ModuleBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
moduleDecl.ModuleStatement.Identifier.ValueText,
GetTypeParameterSuffix(moduleDecl.ModuleStatement.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -246,14 +247,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
DeclaredSymbolInfoKind.Module,
GetAccessibility(moduleDecl, moduleDecl.ModuleStatement.Modifiers),
moduleDecl.ModuleStatement.Identifier.Span,
GetInheritanceNames(project, moduleDecl))
GetInheritanceNames(stringTable, moduleDecl))
Return True
Case SyntaxKind.PropertyStatement
Dim propertyDecl = CType(node, PropertyStatementSyntax)
Dim statementOrBlock = If(TypeOf node.Parent Is PropertyBlockSyntax, node.Parent, node)
Dim propertyParent = statementOrBlock.Parent
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
propertyDecl.Identifier.ValueText, GetPropertySuffix(propertyDecl),
GetContainerDisplayName(propertyParent),
GetFullyQualifiedContainerName(propertyParent),
......@@ -265,7 +266,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
Case SyntaxKind.StructureBlock
Dim structDecl = CType(node, StructureBlockSyntax)
declaredSymbolInfo = New DeclaredSymbolInfo(
project,
stringTable,
structDecl.StructureStatement.Identifier.ValueText,
GetTypeParameterSuffix(structDecl.StructureStatement.TypeParameterList),
GetContainerDisplayName(node.Parent),
......@@ -273,7 +274,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.FindSymbols
DeclaredSymbolInfoKind.Struct,
GetAccessibility(structDecl, structDecl.StructureStatement.Modifiers),
structDecl.StructureStatement.Identifier.Span,
GetInheritanceNames(project, structDecl))
GetInheritanceNames(stringTable, structDecl))
Return True
End Select
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册