提交 86c7f199 编写于 作者: T TomasMatousek

Remove unused code/API

Public types CommonMemberResolutionKind, CommonMemberResolutionResult, CommonOverloadResolutionResult are not used nor returned by any Roslyn public API. Remove them.
 (changeset 1395377)
上级 78e84b0b
...@@ -98,33 +98,6 @@ internal MemberAnalysisResult Result ...@@ -98,33 +98,6 @@ internal MemberAnalysisResult Result
get { return result; } get { return result; }
} }
internal CommonMemberResolutionResult<TSymbol> ToCommon<TSymbol>()
where TSymbol : ISymbol
{
return new CommonMemberResolutionResult<TSymbol>(
(TSymbol)(ISymbol)this.Member,
ConvertKind(this.Resolution),
this.IsValid);
}
private static CommonMemberResolutionKind ConvertKind(MemberResolutionKind kind)
{
switch (kind)
{
case MemberResolutionKind.ApplicableInExpandedForm:
case MemberResolutionKind.ApplicableInNormalForm:
return CommonMemberResolutionKind.Applicable;
case MemberResolutionKind.UseSiteError:
case MemberResolutionKind.UnsupportedMetadata:
return CommonMemberResolutionKind.UseSiteError;
case MemberResolutionKind.TypeInferenceFailed:
case MemberResolutionKind.TypeInferenceExtensionInstanceArgument:
return CommonMemberResolutionKind.TypeInferenceFailed;
default:
return CommonMemberResolutionKind.Worse;
}
}
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
throw new NotSupportedException(); throw new NotSupportedException();
......
...@@ -1237,15 +1237,5 @@ private static ObjectPool<OverloadResolutionResult<TMember>> CreatePool() ...@@ -1237,15 +1237,5 @@ private static ObjectPool<OverloadResolutionResult<TMember>> CreatePool()
} }
#endregion #endregion
internal CommonOverloadResolutionResult<TSymbol> ToCommon<TSymbol>()
where TSymbol : ISymbol
{
return new CommonOverloadResolutionResult<TSymbol>(
this.Succeeded,
this.Succeeded ? this.ValidResult.ToCommon<TSymbol>() : default(CommonMemberResolutionResult<TSymbol>?),
this.HasBestResult ? this.BestResult.ToCommon<TSymbol>() : default(CommonMemberResolutionResult<TSymbol>?),
this.Results.SelectAsArray(r => r.ToCommon<TSymbol>()));
}
} }
} }
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="Settings"> <ImportGroup Label="Settings">
<Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Settings.targets" /> <Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Settings.targets" />
<Import Project="..\..\..\..\..\Closed\Tools\Source\Microsoft.CodeAnalysis.Toolset\Targets\VSL.Settings.Closed.targets" />
</ImportGroup> </ImportGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<OutDir>..\..\..\..\Binaries\$(Configuration)\</OutDir>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform> <Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<ProjectGuid>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</ProjectGuid> <ProjectGuid>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
...@@ -141,9 +141,6 @@ ...@@ -141,9 +141,6 @@
<Compile Include="Collections\SmallDictionary.cs" /> <Compile Include="Collections\SmallDictionary.cs" />
<Compile Include="Collections\UnionCollection.cs" /> <Compile Include="Collections\UnionCollection.cs" />
<Compile Include="Compilation\CandidateReason.cs" /> <Compile Include="Compilation\CandidateReason.cs" />
<Compile Include="Compilation\CommonMemberResolutionKind.cs" />
<Compile Include="Compilation\CommonMemberResolutionResult.cs" />
<Compile Include="Compilation\CommonOverloadResolutionResult.cs" />
<Compile Include="Compilation\Compilation.cs" /> <Compile Include="Compilation\Compilation.cs" />
<Compile Include="Compilation\CompilationOptions.cs" /> <Compile Include="Compilation\CompilationOptions.cs" />
<Compile Include="Compilation\CompilationStage.cs" /> <Compile Include="Compilation\CompilationStage.cs" />
...@@ -662,6 +659,7 @@ ...@@ -662,6 +659,7 @@
<Import Project="..\SharedCollections\SharedCollections.projitems" Label="Shared" /> <Import Project="..\SharedCollections\SharedCollections.projitems" Label="Shared" />
<ImportGroup Label="Targets"> <ImportGroup Label="Targets">
<Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Imports.targets" /> <Import Project="..\..\..\Tools\Microsoft.CodeAnalysis.Toolset.Open\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\..\..\Closed\Tools\Source\Microsoft.CodeAnalysis.Toolset\Targets\VSL.Imports.Closed.targets" />
<Import Project="..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets')" /> <Import Project="..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\..\..\packages\StyleCop.MSBuild.4.7.48.2\build\StyleCop.MSBuild.Targets')" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup> </ImportGroup>
......
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Indicates why the compiler accepted or rejected the member during overload resolution.
/// </summary>
public enum CommonMemberResolutionKind
{
/// <summary>
/// The candidate member was accepted.
/// </summary>
Applicable = 0,
/// <summary>
/// The candidate member was rejected because it is not supported by the language or cannot
/// be used given the current set of assembly references.
/// </summary>
UseSiteError = 1,
/// <summary>
/// The candidate member was rejected because type inference failed.
/// </summary>
TypeInferenceFailed = 2,
/// <summary>
/// The candidate member was rejected because it was considered worse that another member.
/// </summary>
Worse = 3,
}
}
\ No newline at end of file
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Represents the results of overload resolution for a single member.
/// </summary>
public struct CommonMemberResolutionResult<TMember> where TMember : ISymbol
{
/// <summary>
/// The member considered during overload resolution.
/// </summary>
public TMember Member { get; private set; }
/// <summary>
/// Indicates why the compiler accepted or rejected the member during overload resolution.
/// </summary>
public CommonMemberResolutionKind Resolution { get; private set; }
/// <summary>
/// Returns true if the compiler accepted this member as the sole correct result of overload resolution.
/// </summary>
public bool IsValid { get; private set; }
internal CommonMemberResolutionResult(
TMember member,
CommonMemberResolutionKind resolution,
bool isValid)
: this()
{
this.Member = member;
this.Resolution = resolution;
this.IsValid = isValid;
}
}
}
\ No newline at end of file
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Summarizes the results of an overload resolution analysis, as described in section 7.5 of
/// the language specification. Describes whether overload resolution succeeded, and which
/// method was selected if overload resolution succeeded, as well as detailed information about
/// each method that was considered.
/// </summary>
public struct CommonOverloadResolutionResult<TMember> where TMember : ISymbol
{
// Create an overload resolution result from a single result.
internal CommonOverloadResolutionResult(
bool succeeded,
CommonMemberResolutionResult<TMember>? validResult,
CommonMemberResolutionResult<TMember>? bestResult,
ImmutableArray<CommonMemberResolutionResult<TMember>> results)
: this()
{
this.Succeeded = succeeded;
this.ValidResult = validResult;
this.BestResult = bestResult;
this.Results = results;
}
/// <summary>
/// True if overload resolution successfully selected a single best method.
/// </summary>
public bool Succeeded { get; private set; }
/// <summary>
/// If overload resolution successfully selected a single best method, returns information
/// about that method. Otherwise returns null.
/// </summary>
public CommonMemberResolutionResult<TMember>? ValidResult { get; private set; }
/// <summary>
/// If there was a method that overload resolution considered better than all others,
/// returns information about that method. A method may be returned even if that method was
/// not considered a successful overload resolution, as long as it was better that any other
/// potential method considered.
/// </summary>
public CommonMemberResolutionResult<TMember>? BestResult { get; private set; }
/// <summary>
/// Returns information about each method that was considered during overload resolution,
/// and what the results of overload resolution were for that method.
/// </summary>
public ImmutableArray<CommonMemberResolutionResult<TMember>> Results { get; private set; }
}
}
\ No newline at end of file
...@@ -86,25 +86,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ...@@ -86,25 +86,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return m_Candidate.IsExpandedParamArrayForm Return m_Candidate.IsExpandedParamArrayForm
End Get End Get
End Property End Property
Friend Function ToCommon(Of TSymbol As ISymbol)() As CommonMemberResolutionResult(Of TSymbol)
Return New CommonMemberResolutionResult(Of TSymbol)(
DirectCast(DirectCast(Me.Member, ISymbol), TSymbol),
ConvertResolution(Me.Resolution),
Me.IsValid)
End Function
Private Shared Function ConvertResolution(resolution As MemberResolutionKind) As CommonMemberResolutionKind
Select Case resolution
Case MemberResolutionKind.Applicable
Return CommonMemberResolutionKind.Applicable
Case MemberResolutionKind.HasUseSiteError
Return CommonMemberResolutionKind.UseSiteError
Case MemberResolutionKind.TypeInferenceFailed
Return CommonMemberResolutionKind.TypeInferenceFailed
Case Else
Return CommonMemberResolutionKind.Worse
End Select
End Function
End Structure End Structure
End Namespace End Namespace
\ No newline at end of file
...@@ -72,13 +72,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ...@@ -72,13 +72,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return m_Results Return m_Results
End Get End Get
End Property End Property
Friend Function ToCommon(Of TSymbol As ISymbol)() As CommonOverloadResolutionResult(Of TSymbol)
Return New CommonOverloadResolutionResult(Of TSymbol)(
Me.Succeeded,
If(Me.ValidResult.HasValue, Me.ValidResult.Value.ToCommon(Of TSymbol)(), New CommonMemberResolutionResult(Of TSymbol) ?()),
If(Me.BestResult.HasValue, Me.BestResult.Value.ToCommon(Of TSymbol)(), New CommonMemberResolutionResult(Of TSymbol) ?()),
Me.Results.SelectAsArray(Function(r) r.ToCommon(Of TSymbol)()))
End Function
End Class End Class
End Namespace End Namespace
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册