finally fix compiler errors

This commit is contained in:
OMGeeky
2024-06-22 01:22:43 +02:00
parent 8f38308c10
commit 4f5561dfc1
2 changed files with 16 additions and 15 deletions

View File

@@ -83,10 +83,10 @@ internal class {Helpers.UiElementAttribute} : Attribute
, SymbolEqualityComparer.Default ) ) , SymbolEqualityComparer.Default ) )
{ {
var classSymbol = group.Key; var classSymbol = group.Key;
// if (! Helpers.IsDerivedFrom( classSymbol , "AtVisualElement" ) ) if (classSymbol is null || ! Helpers.IsDerivedFrom( classSymbol , "AtVisualElement" ) )
// { {
// continue; continue;
// } }
var classSource = ProcessClassUiElement( classSymbol , group , uiElementAttributeSymbol ); var classSource = ProcessClassUiElement( classSymbol , group , uiElementAttributeSymbol );
if ( classSource == null ) if ( classSource == null )
continue; continue;
@@ -95,14 +95,10 @@ internal class {Helpers.UiElementAttribute} : Attribute
} }
foreach ( var classSymbol in receiver.Classes ) foreach ( var classSymbol in receiver.Classes )
{ {
if ( classSymbol is null ) if (classSymbol is null || ! Helpers.IsDerivedFrom( classSymbol , "AtVisualElement" ) )
{ {
continue; continue;
} }
// if (! Helpers.IsDerivedFrom( classSymbol , "AtVisualElement" ) )
// {
// continue;
// }
var classSource = ProcessClassUiComponent( classSymbol , atUiComponentAttributeSymbol ); var classSource = ProcessClassUiComponent( classSymbol , atUiComponentAttributeSymbol );
if ( classSource == null ) if ( classSource == null )
continue; continue;
@@ -167,7 +163,7 @@ internal class {Helpers.UiElementAttribute} : Attribute
using UnityEngine.UIElements; using UnityEngine.UIElements;
namespace {classSymbol.ContainingNamespace} namespace {classSymbol.ContainingNamespace}
{{ {{
public partial class {classSymbol.Name} : AtVisualElement public partial class {classSymbol.Name}
{{"); {{");
} }
private static void AppendClassFrameEnd( StringBuilder source ) private static void AppendClassFrameEnd( StringBuilder source )

View File

@@ -22,21 +22,26 @@ namespace TestConsole
public partial class Test1 : AtVisualElement public partial class Test1 : AtVisualElement
{ {
// protected override string UxmlPath =>""; // protected override string UxmlPath =>"";
// [UiElement] [UiElement]
public AtVisualElement test; public AtVisualElement test;
public void Test123() public void Test123()
{ {
Console.WriteLine( "test" ); Console.WriteLine( "test start" );
Console.WriteLine( $"UxmlPath: '{UxmlPath}'" );
QueryElements(); QueryElements();
Console.WriteLine( "test end" );
} }
} }
public abstract class AtVisualElement public abstract class AtVisualElement
{ {
protected abstract string UxmlPath { get; } protected AtVisualElement()
// protected virtual string UxmlPath { get; } {
// ReSharper disable once VirtualMemberCallInConstructor
Console.WriteLine( $"UxmlPath: '{UxmlPath}'" );
}
// protected abstract string UxmlPath { get; }
protected virtual string UxmlPath { get; }
protected virtual void QueryElements() protected virtual void QueryElements()
{ {