add a scanner, but this seems to be a wrong solution. Change open-source head

This commit is contained in:
Youmu Liu
2026-07-07 18:20:38 +08:00
parent b053567eb7
commit 1705d7c245
276 changed files with 3468 additions and 7205 deletions
@@ -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());
}
}