提交 96882c7c 编写于 作者: C CyrusNajmabadi

Pass along typecode so we can properly roundtrip value.

上级 afbfe9dd
// 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.Immutable;
using System.Linq;
using System.Threading;
......@@ -215,7 +216,7 @@ internal abstract partial class AbstractFindUsagesService : IFindUsagesService
// We'll take those results, massage them, and forward them along to the
// FindUsagesContext instance we were given.
await SymbolFinder.FindLiteralReferencesAsync(
tokenValue, solution, progressAdapter, cancellationToken).ConfigureAwait(false);
tokenValue, Type.GetTypeCode(tokenValue.GetType()), solution, progressAdapter, cancellationToken).ConfigureAwait(false);
return true;
}
......
// 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.Immutable;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Remote;
......@@ -9,7 +10,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
internal interface IRemoteSymbolFinder
{
Task FindReferencesAsync(SerializableSymbolAndProjectId symbolAndProjectIdArg, DocumentId[] documentArgs);
Task FindLiteralReferencesAsync(object value);
Task FindLiteralReferencesAsync(object value, TypeCode typeCode);
Task<ImmutableArray<SerializableSymbolAndProjectId>> FindAllDeclarationsWithNormalQueryAsync(
ProjectId projectId, string name, SearchKind searchKind, SymbolFilter criteria);
......
// 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.Immutable;
using System.Linq;
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindSymbols.Finders;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Remote;
namespace Microsoft.CodeAnalysis.FindSymbols
{
......@@ -14,6 +11,7 @@ public static partial class SymbolFinder
{
internal static async Task FindLiteralReferencesAsync(
object value,
TypeCode typeCode,
Solution solution,
IStreamingFindLiteralReferencesProgress progress,
CancellationToken cancellationToken)
......@@ -21,7 +19,7 @@ public static partial class SymbolFinder
using (Logger.LogBlock(FunctionId.FindReference, cancellationToken))
{
var handled = await TryFindLiteralReferencesInServiceProcessAsync(
value, solution, progress, cancellationToken).ConfigureAwait(false);
value, typeCode, solution, progress, cancellationToken).ConfigureAwait(false);
if (handled)
{
return;
......@@ -44,6 +42,7 @@ public static partial class SymbolFinder
private static async Task<bool> TryFindLiteralReferencesInServiceProcessAsync(
object value,
TypeCode typeCode,
Solution solution,
IStreamingFindLiteralReferencesProgress progress,
CancellationToken cancellationToken)
......@@ -63,7 +62,7 @@ public static partial class SymbolFinder
await session.InvokeAsync(
nameof(IRemoteSymbolFinder.FindLiteralReferencesAsync),
value).ConfigureAwait(false);
value, typeCode).ConfigureAwait(false);
return true;
}
......
// 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.Immutable;
using System.Linq;
using System.Threading.Tasks;
......@@ -35,13 +36,14 @@ public async Task FindReferencesAsync(SerializableSymbolAndProjectId symbolAndPr
progressCallback, documents, CancellationToken).ConfigureAwait(false);
}
public async Task FindLiteralReferencesAsync(object value)
public async Task FindLiteralReferencesAsync(object value, TypeCode typeCode)
{
var convertedType = System.Convert.ChangeType(value, typeCode);
var solution = await GetSolutionAsync().ConfigureAwait(false);
var progressCallback = new FindLiteralReferencesProgressCallback(this);
await SymbolFinder.FindLiteralReferencesInCurrentProcessAsync(
value, solution, progressCallback, CancellationToken).ConfigureAwait(false);
convertedType, solution, progressCallback, CancellationToken).ConfigureAwait(false);
}
public async Task<ImmutableArray<SerializableSymbolAndProjectId>> FindAllDeclarationsWithNormalQueryAsync(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册