24 changed files with 93 additions and 87 deletions
@ -1,9 +1,9 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using XamlX.TypeSystem; |
using XamlX.TypeSystem; |
||||
|
|
||||
namespace Avalonia.Generators.Domain; |
namespace Avalonia.Generators.Common.Domain; |
||||
|
|
||||
internal interface ICodeGenerator |
internal interface ICodeGenerator |
||||
{ |
{ |
||||
string GenerateCode(string className, string nameSpace, IXamlType xamlType, IEnumerable<ResolvedName> names); |
string GenerateCode(string className, string nameSpace, IXamlType xamlType, IEnumerable<ResolvedName> names); |
||||
} |
} |
||||
@ -1,6 +1,6 @@ |
|||||
namespace Avalonia.Generators.Domain; |
namespace Avalonia.Generators.Common.Domain; |
||||
|
|
||||
internal interface IGlobPattern |
internal interface IGlobPattern |
||||
{ |
{ |
||||
bool Matches(string str); |
bool Matches(string str); |
||||
} |
} |
||||
@ -1,11 +1,19 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using XamlX.Ast; |
using XamlX.Ast; |
||||
|
|
||||
namespace Avalonia.Generators.Domain; |
namespace Avalonia.Generators.Common.Domain; |
||||
|
|
||||
|
internal enum NamedFieldModifier |
||||
|
{ |
||||
|
Public = 0, |
||||
|
Private = 1, |
||||
|
Internal = 2, |
||||
|
Protected = 3, |
||||
|
} |
||||
|
|
||||
internal interface INameResolver |
internal interface INameResolver |
||||
{ |
{ |
||||
IReadOnlyList<ResolvedName> ResolveNames(XamlDocument xaml); |
IReadOnlyList<ResolvedName> ResolveNames(XamlDocument xaml); |
||||
} |
} |
||||
|
|
||||
internal record ResolvedName(string TypeName, string Name, string FieldModifier); |
internal record ResolvedName(string TypeName, string Name, string FieldModifier); |
||||
@ -1,11 +1,11 @@ |
|||||
using XamlX.Ast; |
using XamlX.Ast; |
||||
using XamlX.TypeSystem; |
using XamlX.TypeSystem; |
||||
|
|
||||
namespace Avalonia.Generators.Domain; |
namespace Avalonia.Generators.Common.Domain; |
||||
|
|
||||
internal interface IViewResolver |
internal interface IViewResolver |
||||
{ |
{ |
||||
ResolvedView ResolveView(string xaml); |
ResolvedView ResolveView(string xaml); |
||||
} |
} |
||||
|
|
||||
internal record ResolvedView(string ClassName, IXamlType XamlType, string Namespace, XamlDocument Xaml); |
internal record ResolvedView(string ClassName, IXamlType XamlType, string Namespace, XamlDocument Xaml); |
||||
@ -1,14 +1,13 @@ |
|||||
using System; |
using System; |
||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Linq; |
using System.Linq; |
||||
|
using Avalonia.Generators.Common.Domain; |
||||
using Avalonia.Generators.Compiler; |
using Avalonia.Generators.Compiler; |
||||
using Avalonia.Generators.Domain; |
|
||||
using XamlX; |
using XamlX; |
||||
using XamlX.Ast; |
using XamlX.Ast; |
||||
using XamlX.Parsers; |
using XamlX.Parsers; |
||||
using XamlX.TypeSystem; |
|
||||
|
|
||||
namespace Avalonia.Generators.Generator; |
namespace Avalonia.Generators.Common; |
||||
|
|
||||
internal class XamlXViewResolver : IViewResolver, IXamlAstVisitor |
internal class XamlXViewResolver : IViewResolver, IXamlAstVisitor |
||||
{ |
{ |
||||
@ -1,4 +0,0 @@ |
|||||
// ReSharper disable once CheckNamespace
|
|
||||
namespace System.Runtime.CompilerServices; |
|
||||
|
|
||||
internal static class IsExternalInit { } |
|
||||
@ -1,11 +1,11 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using Microsoft.CodeAnalysis; |
using Microsoft.CodeAnalysis; |
||||
|
|
||||
namespace Avalonia.Generators.Domain; |
namespace Avalonia.Generators.NameGenerator; |
||||
|
|
||||
internal interface INameGenerator |
internal interface INameGenerator |
||||
{ |
{ |
||||
IReadOnlyList<GeneratedPartialClass> GenerateNameReferences(IEnumerable<AdditionalText> additionalFiles); |
IReadOnlyList<GeneratedPartialClass> GenerateNameReferences(IEnumerable<AdditionalText> additionalFiles); |
||||
} |
} |
||||
|
|
||||
internal record GeneratedPartialClass(string FileName, string Content); |
internal record GeneratedPartialClass(string FileName, string Content); |
||||
@ -0,0 +1,21 @@ |
|||||
|
namespace Avalonia.Generators.NameGenerator; |
||||
|
|
||||
|
internal enum Options |
||||
|
{ |
||||
|
Public = 0, |
||||
|
Private = 1, |
||||
|
Internal = 2, |
||||
|
Protected = 3, |
||||
|
} |
||||
|
|
||||
|
internal enum Behavior |
||||
|
{ |
||||
|
OnlyProperties = 0, |
||||
|
InitializeComponent = 1, |
||||
|
} |
||||
|
|
||||
|
internal enum ViewFileNamingStrategy |
||||
|
{ |
||||
|
ClassName = 0, |
||||
|
NamespaceAndClassName = 1, |
||||
|
} |
||||
Loading…
Reference in new issue