feat: erased accidentally added engine files
This commit is contained in:
parent
f0fc98b2b8
commit
202693b275
12525 changed files with 0 additions and 6255369 deletions
|
|
@ -1,50 +0,0 @@
|
|||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.Diagnostics;
|
||||
|
||||
namespace Godot.SourceGenerators
|
||||
{
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public sealed class GlobalClassAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
|
||||
=> ImmutableArray.Create(
|
||||
Common.GlobalClassMustDeriveFromGodotObjectRule,
|
||||
Common.GlobalClassMustNotBeGenericRule);
|
||||
|
||||
public override void Initialize(AnalysisContext context)
|
||||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
|
||||
context.EnableConcurrentExecution();
|
||||
context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.ClassDeclaration);
|
||||
}
|
||||
|
||||
private static void AnalyzeNode(SyntaxNodeAnalysisContext context)
|
||||
{
|
||||
// Return if not a type symbol or the type is not a global class.
|
||||
if (context.ContainingSymbol is not INamedTypeSymbol typeSymbol ||
|
||||
!typeSymbol.GetAttributes().Any(a => a.AttributeClass?.IsGodotGlobalClassAttribute() ?? false))
|
||||
return;
|
||||
|
||||
if (typeSymbol.IsGenericType)
|
||||
{
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.GlobalClassMustNotBeGenericRule,
|
||||
typeSymbol.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
typeSymbol.ToDisplayString()
|
||||
));
|
||||
}
|
||||
|
||||
if (!typeSymbol.InheritsFrom("GodotSharp", GodotClasses.GodotObject))
|
||||
{
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
Common.GlobalClassMustDeriveFromGodotObjectRule,
|
||||
typeSymbol.Locations.FirstLocationWithSourceTreeOrDefault(),
|
||||
typeSymbol.ToDisplayString()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue