From 95c04fcbce71df0e836d86113ff9ee27b3b81dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <1123993881@qq.com> Date: Tue, 23 Dec 2025 16:09:49 +0800 Subject: [PATCH 1/2] feat: add Method impl feature and the default value fix. --- .../Extensions/SyntaxExtensions.cs | 23 +++++++++++++++++-- .../Names/ParameterName.cs | 4 +--- 2 files changed, 22 insertions(+), 5 deletions(-) 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) From 94d33409526e5df2c184db7e752f44fad940f3ab Mon Sep 17 00:00:00 2001 From: nuke-bot Date: Tue, 23 Dec 2025 08:13:17 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=202025.12.23.1=20Released!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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