提交 9b2b97f2 编写于 作者: S srivatsn

Remove IVT from workspaces to the Roslyn analyzers (srivatsn)

This one was straightforward. There were just a couple of transgressions - both easily fixed. (changeset 1408016)
上级 40f2ce12
// 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.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
namespace Roslyn.Diagnostics.Analyzers
{
internal static class ISymbolExtensions
{
public static ImmutableArray<IParameterSymbol> GetParameters(this ISymbol symbol)
{
switch (symbol.Kind)
{
case SymbolKind.Method:
return ((IMethodSymbol)symbol).Parameters;
case SymbolKind.Property:
return ((IPropertySymbol)symbol).Parameters;
default:
return ImmutableArray<IParameterSymbol>.Empty;
}
}
public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol type)
{
var current = type;
while (current != null)
{
yield return current;
current = current.BaseType;
}
}
}
}
......@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
......@@ -74,7 +75,7 @@ protected CompilationAnalyzer(INamedTypeSymbol symbolType, INamedTypeSymbol comp
// If the below assert fire then probably the definition of "SymbolDeclaredEvent" has changed and we need to fix this analyzer.
var symbolDeclaredEvent = compilationType.GetMembers(SymbolDeclaredEventName).Single();
Contract.ThrowIfFalse(symbolDeclaredEvent.GetParameters().Count() == 1);
Debug.Assert(symbolDeclaredEvent.GetParameters().Count() == 1);
}
protected abstract SyntaxNode GetFirstArgumentOfInvocation(SyntaxNode invocation);
......
......@@ -78,6 +78,7 @@
<Compile Include="CodeFixProviderBase.cs" />
<Compile Include="Documentation\DoNotUseVerbatimCrefsAnalyzer.cs" />
<Compile Include="DocumentChangedAction.cs" />
<Compile Include="ISymbolExtensions.cs" />
<Compile Include="Performance\CodeActionCreateAnalyzer.cs" />
<Compile Include="Performance\EmptyArrayDiagnosticAnalyzer.cs" />
<Compile Include="Performance\EquatableAnalyzer.cs" />
......@@ -114,4 +115,4 @@
<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')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -252,9 +252,6 @@
<InternalsVisibleTo Include="Microsoft.VisualStudio.LanguageServices.VisualBasic" />
<InternalsVisibleTo Include="csi" />
<InternalsVisibleTo Include="Roslyn.CSharp.InteractiveEditorFeatures" />
<InternalsVisibleTo Include="Roslyn.Diagnostics.Analyzers" />
<InternalsVisibleTo Include="Roslyn.Diagnostics.Analyzers.CSharp" />
<InternalsVisibleTo Include="Roslyn.Diagnostics.Analyzers.VisualBasic" />
<InternalsVisibleTo Include="Roslyn.InteractiveEditorFeatures" />
<InternalsVisibleTo Include="Roslyn.InteractiveFeatures" />
<InternalsVisibleTo Include="Roslyn.VisualBasic.InteractiveEditorFeatures" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册