diff --git a/Directory.Packages.props b/Directory.Packages.props index 18ea2e80c..822b0c4f0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,6 +14,7 @@ + diff --git a/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs b/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs deleted file mode 100644 index c81232de2..000000000 --- a/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace ICSharpCode.Decompiler.CSharp.Syntax -{ - public sealed class DecompilerAstNodeAttribute : Attribute - { - public DecompilerAstNodeAttribute(bool hasNullNode = false, bool hasPatternPlaceholder = false) { } - } - - public sealed class ExcludeFromMatchAttribute : Attribute - { - } -} \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj b/ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj deleted file mode 100644 index dbdcea46b..000000000 --- a/ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - netstandard2.0 - - - diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs index ed227b617..08b9c19d2 100644 --- a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs +++ b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs @@ -2,8 +2,6 @@ using System.Collections.Immutable; using System.Text; -using ICSharpCode.Decompiler.CSharp.Syntax; - using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -41,7 +39,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator { if (m is not IPropertySymbol property || property.IsIndexer || property.IsOverride) continue; - if (property.GetAttributes().Any(a => a.AttributeClass?.Name == nameof(ExcludeFromMatchAttribute))) + if (property.GetAttributes().Any(a => a.AttributeClass?.Name == "ExcludeFromMatchAttribute")) continue; if (property.Type.MetadataName is "CSharpTokenNode" or "TextLocation") continue; @@ -264,7 +262,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator context.AddSource(source.NodeName + ".g.cs", SourceText.From(builder.ToString(), Encoding.UTF8)); } - private void WriteVisitors(SourceProductionContext context, ImmutableArray source) + void WriteVisitors(SourceProductionContext context, ImmutableArray source) { var builder = new StringBuilder(); @@ -318,6 +316,34 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator var visitorMembers = astNodeAdditions.Collect(); + context + .RegisterPostInitializationOutput(i => i.AddSource("DecompilerSyntaxTreeGeneratorAttributes.g.cs", @" + +using System; + +namespace Microsoft.CodeAnalysis +{ + internal sealed partial class EmbeddedAttribute : global::System.Attribute + { + } +} + +namespace ICSharpCode.Decompiler.CSharp.Syntax +{ + [global::Microsoft.CodeAnalysis.EmbeddedAttribute] + sealed class DecompilerAstNodeAttribute : global::System.Attribute + { + public DecompilerAstNodeAttribute(bool hasNullNode = false, bool hasPatternPlaceholder = false) { } + } + + [global::Microsoft.CodeAnalysis.EmbeddedAttribute] + sealed class ExcludeFromMatchAttribute : global::System.Attribute + { + } +} + +")); + context.RegisterSourceOutput(astNodeAdditions, WriteGeneratedMembers); context.RegisterSourceOutput(visitorMembers, WriteVisitors); } diff --git a/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs b/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs deleted file mode 100644 index b730ca53c..000000000 --- a/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace ICSharpCode.Decompiler.CSharp.Syntax; - -public class DecompilerAstNodeAttribute(bool hasNullNode) : Attribute -{ - public bool HasNullNode { get; } = hasNullNode; -} \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj b/ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj index 6bb2025e4..fc882407c 100644 --- a/ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj +++ b/ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj @@ -8,18 +8,9 @@ 12 - - 4.8.0 - - - - - - - - - + + diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index fdaca9d89..32c6a1937 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -28,7 +28,7 @@ False false - preview + 13 true True ICSharpCode.Decompiler.snk @@ -101,7 +101,6 @@ - diff --git a/ILSpy.sln b/ILSpy.sln index 4c286d1da..17884f664 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -46,8 +46,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.Decompiler.Generators", "ICSharpCode.Decompiler.Generators\ICSharpCode.Decompiler.Generators.csproj", "{0792B524-622B-4B9D-8027-3531ED6A42EB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Decompiler.Generators.Attributes", "ICSharpCode.Decompiler.Generators.Attributes\ICSharpCode.Decompiler.Generators.Attributes.csproj", "{02FE14EC-EEA7-4902-BCBF-0F95FB90C9B3}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -110,10 +108,6 @@ Global {0792B524-622B-4B9D-8027-3531ED6A42EB}.Debug|Any CPU.Build.0 = Debug|Any CPU {0792B524-622B-4B9D-8027-3531ED6A42EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {0792B524-622B-4B9D-8027-3531ED6A42EB}.Release|Any CPU.Build.0 = Release|Any CPU - {02FE14EC-EEA7-4902-BCBF-0F95FB90C9B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02FE14EC-EEA7-4902-BCBF-0F95FB90C9B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02FE14EC-EEA7-4902-BCBF-0F95FB90C9B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02FE14EC-EEA7-4902-BCBF-0F95FB90C9B3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE