diff --git a/Directory.Build.props b/Directory.Build.props index 96447a8..20989ef 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - 2025.12.23.0 + 2025.12.23.1 enable enable preview diff --git a/src/libraries/TedToolkit.RoslynHelper/Extensions/SyntaxExtensions.cs b/src/libraries/TedToolkit.RoslynHelper/Extensions/SyntaxExtensions.cs index 5259b96..1ce1abf 100644 --- a/src/libraries/TedToolkit.RoslynHelper/Extensions/SyntaxExtensions.cs +++ b/src/libraries/TedToolkit.RoslynHelper/Extensions/SyntaxExtensions.cs @@ -1,4 +1,5 @@ -using Microsoft.CodeAnalysis; +using System.Runtime.CompilerServices; +using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using TedToolkit.RoslynHelper.Names; @@ -133,7 +134,25 @@ public static AttributeListSyntax GeneratedCodeAttribute(Type generator) /// public static AttributeSyntax NonUserCodeAttribute() { - return Attribute(IdentifierName("global::System.Diagnostics.DebuggerNonUserCode")); + return Attribute(IdentifierName("global::System.Diagnostics.DebuggerNonUserCodeAttribute")); + } + + /// + /// Method Impl Attribute + /// + /// + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static AttributeSyntax MethodImplAttribute(MethodImplOptions methodImplOptions) + { + return Attribute(IdentifierName("global::System.Runtime.CompilerServices.MethodImplAttribute")) + .WithArgumentList(AttributeArgumentList( + [ + AttributeArgument(MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + IdentifierName("global::System.Runtime.CompilerServices.MethodImplOptions"), + IdentifierName("AggressiveInlining"))) + ])); } /// diff --git a/src/libraries/TedToolkit.RoslynHelper/Names/ParameterName.cs b/src/libraries/TedToolkit.RoslynHelper/Names/ParameterName.cs index bb2c0f7..52d8bb3 100644 --- a/src/libraries/TedToolkit.RoslynHelper/Names/ParameterName.cs +++ b/src/libraries/TedToolkit.RoslynHelper/Names/ParameterName.cs @@ -89,9 +89,7 @@ public ParameterSyntax ParameterSyntax if (value == null) { - return type.IsValueType - ? LiteralExpression(SyntaxKind.DefaultLiteralExpression) - : LiteralExpression(SyntaxKind.NullLiteralExpression); + return LiteralExpression(SyntaxKind.DefaultLiteralExpression); } switch (type.SpecialType)