Skip to content

Commit 89e9fe8

Browse files
fix: cleanup unused code and methods (#4622)
1 parent 0f9609a commit 89e9fe8

17 files changed

+24
-832
lines changed

TUnit.Core.SourceGenerator/CodeGenerators/Helpers/AotConversionHelper.cs

Lines changed: 0 additions & 102 deletions
This file was deleted.

TUnit.Core.SourceGenerator/CodeGenerators/Helpers/DynamicTestSourceDataModelRetriever.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

TUnit.Core.SourceGenerator/CodeGenerators/Helpers/RequiredPropertyHelper.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,6 @@ public static IEnumerable<IPropertySymbol> GetAllRequiredProperties(ITypeSymbol
2626
return requiredProperties;
2727
}
2828

29-
/// <summary>
30-
/// Gets required properties that have data source attributes
31-
/// </summary>
32-
public static IEnumerable<IPropertySymbol> GetRequiredPropertiesWithDataSource(ITypeSymbol typeSymbol)
33-
{
34-
return GetAllRequiredProperties(typeSymbol)
35-
.Where(p => HasDataSourceAttribute(p));
36-
}
37-
38-
/// <summary>
39-
/// Gets required properties that don't have data source attributes
40-
/// </summary>
41-
public static IEnumerable<IPropertySymbol> GetRequiredPropertiesWithoutDataSource(ITypeSymbol typeSymbol)
42-
{
43-
return GetAllRequiredProperties(typeSymbol)
44-
.Where(p => !HasDataSourceAttribute(p));
45-
}
46-
4729
private static bool HasDataSourceAttribute(IPropertySymbol property)
4830
{
4931
return property.GetAttributes().Any(attr =>

TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TypedConstantParser.cs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,6 @@ namespace TUnit.Core.SourceGenerator.CodeGenerators.Helpers;
99
public static class TypedConstantParser
1010
{
1111
private static readonly TypedConstantFormatter _formatter = new();
12-
13-
public static string GetTypedConstantValue(SemanticModel semanticModel,
14-
(TypedConstant typedConstant, AttributeArgumentSyntax a) element, ITypeSymbol? parameterType)
15-
{
16-
// For constant values, use the formatter which handles type conversions properly
17-
if (element.typedConstant.Kind == TypedConstantKind.Primitive)
18-
{
19-
return _formatter.FormatForCode(element.typedConstant, parameterType);
20-
}
21-
22-
var argumentExpression = element.a.Expression;
23-
24-
var newExpression = argumentExpression.Accept(new FullyQualifiedWithGlobalPrefixRewriter(semanticModel))!;
25-
26-
if (parameterType?.TypeKind == TypeKind.Enum &&
27-
(newExpression.IsKind(SyntaxKind.UnaryMinusExpression) || newExpression.IsKind(SyntaxKind.UnaryPlusExpression)))
28-
{
29-
return $"({parameterType.GloballyQualified()})({newExpression})";
30-
}
31-
32-
if (parameterType?.SpecialType == SpecialType.System_Decimal)
33-
{
34-
return $"{newExpression.ToString().TrimEnd('d')}m";
35-
}
36-
37-
if (parameterType is not null
38-
&& element.typedConstant.Type is not null
39-
&& semanticModel.Compilation.ClassifyConversion(element.typedConstant.Type, parameterType) is
40-
{ IsExplicit: true, IsImplicit: false })
41-
{
42-
return $"({parameterType.GloballyQualified()})({newExpression})";
43-
}
44-
45-
return newExpression.ToString();
46-
}
4712

4813
public static string GetFullyQualifiedTypeNameFromTypedConstantValue(TypedConstant typedConstant)
4914
{
@@ -72,11 +37,6 @@ public static string GetRawTypedConstantValue(TypedConstant typedConstant, IType
7237
return _formatter.FormatForCode(typedConstant, targetType);
7338
}
7439

75-
private static string FormatPrimitive(TypedConstant typedConstant)
76-
{
77-
return FormatPrimitive(typedConstant.Value);
78-
}
79-
8040
public static string FormatPrimitive(object? value)
8141
{
8242
// Check for special floating-point values first

TUnit.Core.SourceGenerator/CodeGenerators/Helpers/TypedDataSourceOptimizer.cs

Lines changed: 0 additions & 114 deletions
This file was deleted.

TUnit.Core.SourceGenerator/CodeGenerators/Writers/Hooks/TestHooksWriter.cs

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)