提交 c632be8e 编写于 作者: H Heejae Chang

made solution to compile without v1 engine.

上级 fec63190
......@@ -102,32 +102,13 @@ public override string BuildTool
}
}
public class ArgumentKey : AnalyzerUpdateArgsId
public class ArgumentKey : LiveDiagnosticUpdateArgsId
{
public readonly StateType StateType;
public readonly object Key;
public ArgumentKey(DiagnosticAnalyzer analyzer, StateType stateType, object key) : base(analyzer)
public ArgumentKey(DiagnosticAnalyzer analyzer, StateType stateType, object key) : base(analyzer, key, (int)stateType)
{
StateType = stateType;
Key = key;
}
public override bool Equals(object obj)
{
var other = obj as ArgumentKey;
if (other == null)
{
return false;
}
return StateType == other.StateType && Equals(Key, other.Key) && base.Equals(obj);
}
public override int GetHashCode()
{
return Hash.Combine(Key, Hash.Combine((int)StateType, base.GetHashCode()));
}
public StateType StateType => (StateType)Kind;
}
}
}
// 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.Generic;
using System.Collections.Immutable;
using System.Linq;
......@@ -7,6 +8,7 @@
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Options;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics.EngineV2
......
// 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 Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Diagnostics
{
internal class LiveDiagnosticUpdateArgsId : AnalyzerUpdateArgsId
{
public readonly object Key;
public readonly int Kind;
public LiveDiagnosticUpdateArgsId(DiagnosticAnalyzer analyzer, object key, int kind) : base(analyzer)
{
Key = key;
Kind = kind;
}
public override bool Equals(object obj)
{
var other = obj as LiveDiagnosticUpdateArgsId;
if (other == null)
{
return false;
}
return Kind == other.Kind && Equals(Key, other.Key) && base.Equals(obj);
}
public override int GetHashCode()
{
return Hash.Combine(Key, Hash.Combine(Kind, base.GetHashCode()));
}
}
}
......@@ -182,9 +182,26 @@
<Compile Include="Diagnostics\AnalyzerHelper.cs" />
<Compile Include="Diagnostics\AbstractHostDiagnosticUpdateSource.cs" />
<Compile Include="Diagnostics\AnalyzerUpdateArgsId.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticAnalyzerDriver.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.AnalyzerExecutor.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.DiagnosticState.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.NestedTypes.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.ProjectAnalyzerReferenceChangedEventArgs.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateSet.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateType.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_BuildSynchronization.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_GetLatestDiagnosticsForSpan.cs" />
<Compile Include="Diagnostics\EngineV1\MemberRangeMap.cs" />
<Compile Include="Diagnostics\LiveDiagnosticUpdateArgsId.cs" />
<Compile Include="Diagnostics\DiagnosticEventTaskScheduler.cs" />
<Compile Include="Diagnostics\DiagnosticService_UpdateSourceRegistrationService.cs" />
<Compile Include="Common\UpdatedEventArgs.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerCategory.cs" />
<Compile Include="Diagnostics\EngineV2\CompilerDiagnosticExecutor.cs" />
<Compile Include="Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ActiveFileState.cs" />
<Compile Include="Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs" />
......@@ -197,13 +214,6 @@
<Compile Include="Diagnostics\InternalDiagnosticsOptionsProvider.cs" />
<Compile Include="Diagnostics\PredefinedBuildTools.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerService_BuildSynchronization.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.ProjectAnalyzerReferenceChangedEventArgs.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateSet.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_BuildSynchronization.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_GetLatestDiagnosticsForSpan.cs" />
<Compile Include="Diagnostics\BuildToolId.cs" />
<Compile Include="Diagnostics\HostAnalyzerManager.cs" />
<Compile Include="Diagnostics\Analyzers\IDEDiagnosticIds.cs" />
......@@ -218,10 +228,6 @@
<Compile Include="Diagnostics\DiagnosticProviderMetadata.cs" />
<Compile Include="Diagnostics\DiagnosticService.cs" />
<Compile Include="Diagnostics\DiagnosticsUpdatedArgs.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.AnalyzerExecutor.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.NestedTypes.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.StateType.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerService_IncrementalAnalyzer.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerService_UpdateSource.cs" />
<Compile Include="Diagnostics\IAnalyzerDriverService.cs" />
......@@ -283,11 +289,6 @@
<Compile Include="Diagnostics\Analyzers\RemoveUnnecessaryCastDiagnosticAnalyzerBase.cs" />
<Compile Include="Diagnostics\Analyzers\RemoveUnnecessaryImportsDiagnosticAnalyzerBase.cs" />
<Compile Include="Diagnostics\Analyzers\SimplifyTypeNamesDiagnosticAnalyzerBase.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticAnalyzerDriver.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticAnalyzerCategory.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.DiagnosticState.cs" />
<Compile Include="Diagnostics\EngineV1\DiagnosticIncrementalAnalyzer.cs" />
<Compile Include="Diagnostics\EngineV1\MemberRangeMap.cs" />
<Compile Include="DocumentationComments\AbstractDocumentationCommentFormattingService.cs" />
<Compile Include="DocumentationComments\IDocumentationCommentFormattingService.cs" />
<Compile Include="EditAndContinue\AbstractEditAndContinueAnalyzer.cs" />
......@@ -577,6 +578,7 @@
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
</ItemGroup>
<ItemGroup />
<Import Project="..\..\..\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems" Label="Shared" />
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
......
......@@ -123,14 +123,14 @@ private object CreateAggregationKey(object data)
return GetItemKey(data);
}
var argumentKey = args.Id as DiagnosticIncrementalAnalyzer.ArgumentKey;
if (argumentKey == null)
var liveArgsId = args.Id as LiveDiagnosticUpdateArgsId;
if (liveArgsId == null)
{
return GetItemKey(data);
}
var documents = args.Solution.GetRelatedDocumentIds(args.DocumentId);
return new AggregatedKey(documents, argumentKey.Analyzer, argumentKey.StateType);
return new AggregatedKey(documents, liveArgsId.Analyzer, liveArgsId.Kind);
}
private void PopulateInitialData(Workspace workspace, IDiagnosticService diagnosticService)
......
......@@ -104,13 +104,13 @@ protected class AggregatedKey
{
public readonly ImmutableArray<DocumentId> DocumentIds;
public readonly DiagnosticAnalyzer Analyzer;
public readonly DiagnosticIncrementalAnalyzer.StateType StateType;
public readonly int Kind;
public AggregatedKey(ImmutableArray<DocumentId> documentIds, DiagnosticAnalyzer analyzer, DiagnosticIncrementalAnalyzer.StateType stateType)
public AggregatedKey(ImmutableArray<DocumentId> documentIds, DiagnosticAnalyzer analyzer, int kind)
{
DocumentIds = documentIds;
Analyzer = analyzer;
StateType = stateType;
Kind = kind;
}
public override bool Equals(object obj)
......@@ -121,12 +121,12 @@ public override bool Equals(object obj)
return false;
}
return this.DocumentIds == other.DocumentIds && this.Analyzer == other.Analyzer && this.StateType == other.StateType;
return this.DocumentIds == other.DocumentIds && this.Analyzer == other.Analyzer && this.Kind == other.Kind;
}
public override int GetHashCode()
{
return Hash.Combine(Analyzer.GetHashCode(), Hash.Combine(DocumentIds.GetHashCode(), (int)StateType));
return Hash.Combine(Analyzer.GetHashCode(), Hash.Combine(DocumentIds.GetHashCode(), Kind));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册