add a scanner, but this seems to be a wrong solution. Change open-source head
This commit is contained in:
@@ -1,50 +1,57 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// file="PanelStateIncrementalGenerator.Analysis"
|
||||
// Project: StgSharp
|
||||
// Copyright (c) Nitload.
|
||||
// SPDX-License-Identifier: MIT
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
||||
namespace StgSharp.UserInterface.Generator;
|
||||
|
||||
internal static class PanelStateIncrementalGeneratorAnalysis
|
||||
namespace StgSharp.UserInterface.Generator
|
||||
{
|
||||
public static PanelStateIncrementalGeneratorOutput Analyze(
|
||||
PanelStateIncrementalGeneratorInput input
|
||||
)
|
||||
internal static class PanelStateIncrementalGeneratorAnalysis
|
||||
{
|
||||
if (input.TypeTargets.IsDefaultOrEmpty)
|
||||
{
|
||||
return new PanelStateIncrementalGeneratorOutput(
|
||||
input.Compilation,
|
||||
ImmutableArray<PanelStateIncrementalGeneratorTypeAnalysis>.Empty);
|
||||
}
|
||||
|
||||
HashSet<string> emittedTypes = new(StringComparer.Ordinal);
|
||||
ImmutableArray<PanelStateIncrementalGeneratorTypeAnalysis>.Builder builder =
|
||||
ImmutableArray.CreateBuilder<PanelStateIncrementalGeneratorTypeAnalysis>();
|
||||
|
||||
foreach (PanelStateIncrementalGeneratorTypeTarget target in input.TypeTargets
|
||||
.OrderBy(static item => item.TypeDisplayName, StringComparer.Ordinal))
|
||||
public static PanelStateIncrementalGeneratorOutput Analyze(
|
||||
PanelStateIncrementalGeneratorInput input
|
||||
)
|
||||
{
|
||||
if (!emittedTypes.Add(target.TypeDisplayName))
|
||||
{
|
||||
continue;
|
||||
if (input.TypeTargets.IsDefaultOrEmpty) {
|
||||
return new PanelStateIncrementalGeneratorOutput(
|
||||
input.Compilation,
|
||||
ImmutableArray<PanelStateIncrementalGeneratorTypeAnalysis>.Empty);
|
||||
}
|
||||
|
||||
PanelStateSymbolPartAnalysis stateSymbols = PanelStateIncrementalGeneratorStateSymbols.Analyze(target);
|
||||
StateChangeBindingPartAnalysis stateChangeBindings = PanelStateIncrementalGeneratorStateChangeBindings.Analyze(target);
|
||||
HashSet<string> emittedTypes = new(StringComparer.Ordinal);
|
||||
ImmutableArray<PanelStateIncrementalGeneratorTypeAnalysis>.Builder builder =
|
||||
ImmutableArray.CreateBuilder<PanelStateIncrementalGeneratorTypeAnalysis>();
|
||||
|
||||
builder.Add(
|
||||
new PanelStateIncrementalGeneratorTypeAnalysis(
|
||||
target,
|
||||
stateSymbols,
|
||||
stateChangeBindings,
|
||||
PanelStateIncrementalGeneratorStateCommandHandlers.Analyze(
|
||||
target,
|
||||
stateSymbols,
|
||||
stateChangeBindings)));
|
||||
foreach (PanelStateIncrementalGeneratorTypeTarget target in input.TypeTargets
|
||||
.OrderBy(static item => item.TypeDisplayName, StringComparer.Ordinal))
|
||||
{
|
||||
if (!emittedTypes.Add(target.TypeDisplayName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PanelStateSymbolPartAnalysis stateSymbols = PanelStateIncrementalGeneratorStateSymbols.Analyze(target);
|
||||
StateChangeBindingPartAnalysis stateChangeBindings = PanelStateIncrementalGeneratorStateChangeBindings.Analyze(target);
|
||||
|
||||
builder.Add(
|
||||
new PanelStateIncrementalGeneratorTypeAnalysis(target, stateSymbols,
|
||||
stateChangeBindings,
|
||||
PanelStateIncrementalGeneratorStateCommandHandlers.Analyze(
|
||||
target,
|
||||
stateSymbols,
|
||||
stateChangeBindings)));
|
||||
}
|
||||
|
||||
return new PanelStateIncrementalGeneratorOutput(
|
||||
input.Compilation,
|
||||
builder.ToImmutable());
|
||||
}
|
||||
|
||||
return new PanelStateIncrementalGeneratorOutput(
|
||||
input.Compilation,
|
||||
builder.ToImmutable());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user