namespace change

This commit is contained in:
Adam Hathcock
2024-05-21 16:33:33 +01:00
parent 5f92c81965
commit 1734d5162a
34 changed files with 82 additions and 83 deletions
@@ -1,8 +1,8 @@
using System.Text;
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Extensions;
using Speckle.ProxyGenerator.Extensions;
namespace ProxyInterfaceSourceGenerator.Builders;
namespace Speckle.ProxyGenerator.Builders;
internal static class MethodParameterBuilder
{
+1 -1
View File
@@ -1,4 +1,4 @@
namespace ProxyInterfaceSourceGenerator.Enums;
namespace Speckle.ProxyGenerator.Enums;
internal enum TypeEnum
{
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class MethodSymbolExtensions
{
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class NamedTypeSymbolExtensions
{
@@ -1,8 +1,8 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using ProxyInterfaceSourceGenerator.Enums;
using Speckle.ProxyGenerator.Enums;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class ParameterSymbolExtensions
{
@@ -1,8 +1,8 @@
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Enums;
using ProxyInterfaceSourceGenerator.FileGenerators;
using Speckle.ProxyGenerator.Enums;
using Speckle.ProxyGenerator.FileGenerators;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class PropertySymbolExtensions
{
@@ -1,6 +1,6 @@
using System.Globalization;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class StringExtensions
{
@@ -1,17 +1,17 @@
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System.Text;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class SymbolExtensions
{
private static readonly string[] ExcludedAttributes =
{
[
"System.Runtime.CompilerServices.NullableAttribute",
"System.Runtime.CompilerServices.NullableContextAttribute",
"System.Runtime.CompilerServices.AsyncStateMachineAttribute"
};
];
public static IReadOnlyList<string> GetAttributesAsList(this ISymbol symbol)
{
@@ -1,8 +1,8 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System.Diagnostics.CodeAnalysis;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class SyntaxNodeExtensions
{
@@ -1,7 +1,7 @@
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Enums;
using Speckle.ProxyGenerator.Enums;
namespace ProxyInterfaceSourceGenerator.Extensions;
namespace Speckle.ProxyGenerator.Extensions;
internal static class TypeSymbolExtensions
{
@@ -2,12 +2,12 @@ using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Builders;
using ProxyInterfaceSourceGenerator.Enums;
using ProxyInterfaceSourceGenerator.Extensions;
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Builders;
using Speckle.ProxyGenerator.Enums;
using Speckle.ProxyGenerator.Extensions;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal abstract class BaseGenerator
{
@@ -153,7 +153,7 @@ internal abstract class BaseGenerator
}
else if (typeSymbol is IArrayTypeSymbol arrayTypeSymbol)
{
typeArguments = new[] { arrayTypeSymbol.ElementType };
typeArguments = [arrayTypeSymbol.ElementType];
}
else
{
@@ -1,6 +1,6 @@
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal class ExtraFilesGenerator : IFileGenerator
{
@@ -1,6 +1,6 @@
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal interface IFileGenerator
{
@@ -1,6 +1,6 @@
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal interface IFilesGenerator
{
@@ -2,12 +2,12 @@ using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ProxyInterfaceSourceGenerator.Enums;
using ProxyInterfaceSourceGenerator.Extensions;
using ProxyInterfaceSourceGenerator.Models;
using ProxyInterfaceSourceGenerator.Utils;
using Speckle.ProxyGenerator.Enums;
using Speckle.ProxyGenerator.Extensions;
using Speckle.ProxyGenerator.Models;
using Speckle.ProxyGenerator.Utils;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
{
@@ -1,7 +1,7 @@
using System.Text;
using ProxyInterfaceSourceGenerator.Extensions;
using Speckle.ProxyGenerator.Extensions;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal partial class ProxyClassesGenerator
{
@@ -1,7 +1,7 @@
using System.Text;
using ProxyInterfaceSourceGenerator.Extensions;
using Speckle.ProxyGenerator.Extensions;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal partial class ProxyClassesGenerator
{
@@ -1,14 +1,14 @@
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Builders;
using ProxyInterfaceSourceGenerator.Enums;
using ProxyInterfaceSourceGenerator.Extensions;
using ProxyInterfaceSourceGenerator.Models;
using ProxyInterfaceSourceGenerator.Types;
using ProxyInterfaceSourceGenerator.Utils;
using Speckle.ProxyGenerator.Builders;
using Speckle.ProxyGenerator.Enums;
using Speckle.ProxyGenerator.Extensions;
using Speckle.ProxyGenerator.Models;
using Speckle.ProxyGenerator.Types;
using Speckle.ProxyGenerator.Utils;
namespace ProxyInterfaceSourceGenerator.FileGenerators;
namespace Speckle.ProxyGenerator.FileGenerators;
internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
{
@@ -215,7 +215,7 @@ operators}
if (method.IsOverride && method.OverriddenMethod != null)
{
var baseType = method.OverriddenMethod.ContainingType.GetFullType();
if (TryGetNamedTypeSymbolByFullName(TypeKind.Class, baseType, Enumerable.Empty<string>(), out _))
if (TryGetNamedTypeSymbolByFullName(TypeKind.Class, baseType, [], out _))
{
overrideOrVirtual = "override ";
}
@@ -1,6 +1,6 @@
using Microsoft.CodeAnalysis;
namespace ProxyInterfaceSourceGenerator.Models;
namespace Speckle.ProxyGenerator.Models;
internal record ClassSymbol(INamedTypeSymbol Symbol, List<INamedTypeSymbol> BaseTypes, List<INamedTypeSymbol> Interfaces)
{
@@ -1,4 +1,4 @@
namespace ProxyInterfaceSourceGenerator.Models;
namespace Speckle.ProxyGenerator.Models;
internal record ConstraintInfo(string Type, List<string> Items)
{
+1 -1
View File
@@ -1,7 +1,7 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace ProxyInterfaceSourceGenerator.Models;
namespace Speckle.ProxyGenerator.Models;
internal record Context
{
@@ -1,3 +1,3 @@
namespace ProxyInterfaceSourceGenerator.Models;
namespace Speckle.ProxyGenerator.Models;
internal record FileData(string FileName, string Text);
@@ -1,6 +1,6 @@
using ProxyInterfaceSourceGenerator.Types;
using Speckle.ProxyGenerator.Types;
namespace ProxyInterfaceSourceGenerator.Models;
namespace Speckle.ProxyGenerator.Models;
internal class ProxyData
{
@@ -2,11 +2,11 @@ using System.Text;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
using ProxyInterfaceSourceGenerator.FileGenerators;
using ProxyInterfaceSourceGenerator.Models;
using ProxyInterfaceSourceGenerator.SyntaxReceiver;
using Speckle.ProxyGenerator.FileGenerators;
using Speckle.ProxyGenerator.Models;
using Speckle.ProxyGenerator.SyntaxReceiver;
namespace ProxyInterfaceSourceGenerator;
namespace Speckle.ProxyGenerator;
[Generator]
#if DEBUG
@@ -1,12 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ProxyInterfaceSourceGenerator.Extensions;
using ProxyInterfaceSourceGenerator.Types;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Speckle.ProxyGenerator.Extensions;
using Speckle.ProxyGenerator.Types;
namespace ProxyInterfaceSourceGenerator.SyntaxReceiver;
namespace Speckle.ProxyGenerator.SyntaxReceiver;
internal static class AttributeArgumentListParser
{
@@ -108,7 +107,7 @@ internal static class AttributeArgumentListParser
value = strings.ToArray();
return true;
}
value = Array.Empty<string>();
value = [];
return false;
}
}
}
@@ -1,16 +1,16 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ProxyInterfaceSourceGenerator.Extensions;
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Extensions;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.SyntaxReceiver;
namespace Speckle.ProxyGenerator.SyntaxReceiver;
internal class ProxySyntaxReceiver : ISyntaxContextReceiver
{
private const string GlobalPrefix = "global::";
private static readonly string[] GenerateProxyAttributes = { "ProxyInterfaceGenerator.Proxy", "Proxy" };
private static readonly string[] Modifiers = { "public", "partial" };
private static readonly string[] GenerateProxyAttributes = ["ProxyInterfaceGenerator.Proxy", "Proxy"];
private static readonly string[] Modifiers = ["public", "partial"];
public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; } = new Dictionary<InterfaceDeclarationSyntax, ProxyData>();
public void OnVisitSyntaxNode(GeneratorSyntaxContext context)
@@ -83,4 +83,4 @@ internal class ProxySyntaxReceiver : ISyntaxContextReceiver
return true;
}
}
}
@@ -1,9 +1,9 @@
namespace ProxyInterfaceSourceGenerator.Types;
namespace Speckle.ProxyGenerator.Types;
internal record ProxyInterfaceGeneratorAttributeArguments(string FullyQualifiedDisplayString, string MetadataName)
{
public bool ProxyBaseClasses { get; set; }
public ProxyClassAccessibility Accessibility { get; set; }
public string[] MembersToIgnore { get; set; } = Array.Empty<string>();
}
public string[] MembersToIgnore { get; set; } = [];
}
@@ -1,4 +1,4 @@
namespace ProxyInterfaceSourceGenerator.Types;
namespace Speckle.ProxyGenerator.Types;
[Flags]
internal enum ProxyClassAccessibility
@@ -1,11 +1,11 @@
using Microsoft.CodeAnalysis;
using ProxyInterfaceSourceGenerator.Models;
using Speckle.ProxyGenerator.Models;
namespace ProxyInterfaceSourceGenerator.Utils;
namespace Speckle.ProxyGenerator.Utils;
internal static class MemberHelper
{
private static readonly string[] ExcludedMethods = { "ToString", "GetHashCode" };
private static readonly string[] ExcludedMethods = ["ToString", "GetHashCode"];
public static IReadOnlyList<IPropertySymbol> GetPublicProperties(
ClassSymbol classSymbol,
@@ -1,4 +1,4 @@
namespace ProxyInterfaceSourceGenerator.Utils;
namespace Speckle.ProxyGenerator.Utils;
internal static class NamespaceBuilder
{
@@ -2,7 +2,7 @@ using CSharp.SourceGenerators.Extensions;
using CSharp.SourceGenerators.Extensions.Models;
using CultureAwareTesting.xUnit;
using FluentAssertions;
using ProxyInterfaceSourceGenerator;
using Speckle.ProxyGenerator;
namespace ProxyInterfaceSourceGeneratorTests;
@@ -3,8 +3,8 @@ using CSharp.SourceGenerators.Extensions.Models;
using FluentAssertions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using ProxyInterfaceSourceGenerator;
using ProxyInterfaceSourceGeneratorTests.Source.Disposable;
using Speckle.ProxyGenerator;
using Xunit.Abstractions;
namespace ProxyInterfaceSourceGeneratorTests;
@@ -3,7 +3,7 @@ using System.Linq;
using CSharp.SourceGenerators.Extensions;
using CSharp.SourceGenerators.Extensions.Models;
using FluentAssertions;
using ProxyInterfaceSourceGenerator;
using Speckle.ProxyGenerator;
using Xunit;
namespace ProxyInterfaceSourceGeneratorTests;
@@ -2,8 +2,8 @@ using System.Runtime.CompilerServices;
using CSharp.SourceGenerators.Extensions;
using CSharp.SourceGenerators.Extensions.Models;
using FluentAssertions;
using ProxyInterfaceSourceGenerator;
using ProxyInterfaceSourceGeneratorTests.Source;
using Speckle.ProxyGenerator;
namespace ProxyInterfaceSourceGeneratorTests;