From dd983ba690bb0b2f072ee756fe759e9a5183bd6b Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jan 2025 19:56:56 +0100 Subject: [PATCH 01/15] Add AST source generator projects --- Directory.Packages.props | 2 + .../DecompilerAstNodeAttribute.cs | 13 + ...de.Decompiler.Generators.Attributes.csproj | 7 + .../DecompilerSyntaxTreeGenerator.cs | 289 ++++++++++++++++++ .../GeneratorAttributes.cs | 8 + .../ICSharpCode.Decompiler.Generators.csproj | 25 ++ .../IsExternalInit.cs | 3 + .../RoslynHelpers.cs | 32 ++ .../TreeTraversal.cs | 125 ++++++++ ICSharpCode.Decompiler/packages.lock.json | 3 + ILSpy.sln | 12 + 11 files changed, 519 insertions(+) create mode 100644 ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs create mode 100644 ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj create mode 100644 ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs create mode 100644 ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs create mode 100644 ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj create mode 100644 ICSharpCode.Decompiler.Generators/IsExternalInit.cs create mode 100644 ICSharpCode.Decompiler.Generators/RoslynHelpers.cs create mode 100644 ICSharpCode.Decompiler.Generators/TreeTraversal.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 4aa51ddaf..18ea2e80c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,8 +14,10 @@ + + diff --git a/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs b/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs new file mode 100644 index 000000000..b0d1924dc --- /dev/null +++ b/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs @@ -0,0 +1,13 @@ +using System; + +namespace ICSharpCode.Decompiler.CSharp.Syntax +{ + public sealed class DecompilerAstNodeAttribute : Attribute + { + public DecompilerAstNodeAttribute(bool hasNullNode) { } + } + + 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 new file mode 100644 index 000000000..dbdcea46b --- /dev/null +++ b/ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs new file mode 100644 index 000000000..c11027f53 --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs @@ -0,0 +1,289 @@ +using System.Collections; +using System.Collections.Immutable; +using System.Text; + +using ICSharpCode.Decompiler.CSharp.Syntax; + +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; + +namespace ICSharpCode.Decompiler.Generators; + +[Generator] +internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator +{ + record AstNodeAdditions(string NodeName, bool NeedsAcceptImpls, bool NeedsVisitor, bool NeedsNullNode, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? MembersToMatch); + + AstNodeAdditions GetAstNodeAdditions(GeneratorAttributeSyntaxContext context, CancellationToken ct) + { + var targetSymbol = (INamedTypeSymbol)context.TargetSymbol; + var attribute = context.Attributes.SingleOrDefault(ad => ad.AttributeClass?.Name == "DecompilerAstNodeAttribute")!; + var (visitMethodName, paramTypeName) = targetSymbol.Name switch { + "ErrorExpression" => ("ErrorNode", "AstNode"), + string s when s.Contains("AstType") => (s.Replace("AstType", "Type"), s), + _ => (targetSymbol.Name, targetSymbol.Name), + }; + + List<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? membersToMatch = null; + + if (!targetSymbol.MemberNames.Contains("DoMatch")) + { + membersToMatch = new(); + + var astNodeType = (INamedTypeSymbol)context.SemanticModel.GetSpeculativeSymbolInfo(context.TargetNode.Span.Start, SyntaxFactory.ParseTypeName("AstNode"), SpeculativeBindingOption.BindAsTypeOrNamespace).Symbol!; + + if (targetSymbol.BaseType!.MemberNames.Contains("MatchAttributesAndModifiers")) + membersToMatch.Add(("MatchAttributesAndModifiers", null!, false, false)); + + foreach (var m in targetSymbol.GetMembers()) + { + if (m is not IPropertySymbol property || property.IsIndexer || property.IsOverride) + continue; + if (property.GetAttributes().Any(a => a.AttributeClass?.Name == nameof(ExcludeFromMatchAttribute))) + continue; + if (property.Type.MetadataName is "CSharpTokenNode" or "TextLocation") + continue; + switch (property.Type) + { + case INamedTypeSymbol named when named.IsDerivedFrom(astNodeType) || named.MetadataName == "AstNodeCollection`1": + membersToMatch.Add((property.Name, named.Name, true, false)); + break; + case INamedTypeSymbol { TypeKind: TypeKind.Enum } named when named.GetMembers().Any(_ => _.Name == "Any"): + membersToMatch.Add((property.Name, named.Name, false, true)); + break; + default: + membersToMatch.Add((property.Name, property.Type.Name, false, false)); + break; + } + } + } + + return new(targetSymbol.Name, !targetSymbol.MemberNames.Contains("AcceptVisitor"), + NeedsVisitor: !targetSymbol.IsAbstract && targetSymbol.BaseType!.IsAbstract, + NeedsNullNode: (bool)attribute.ConstructorArguments[0].Value!, + NullNodeBaseCtorParamCount: targetSymbol.InstanceConstructors.Min(m => m.Parameters.Length), + IsTypeNode: targetSymbol.Name == "AstType" || targetSymbol.BaseType?.Name == "AstType", + visitMethodName, paramTypeName, membersToMatch?.ToEquatableArray()); + } + + void WriteGeneratedMembers(SourceProductionContext context, AstNodeAdditions source) + { + var builder = new StringBuilder(); + + builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); + builder.AppendLine(); + + builder.AppendLine("#nullable enable"); + builder.AppendLine(); + + builder.AppendLine($"partial class {source.NodeName}"); + builder.AppendLine("{"); + + if (source.NeedsNullNode) + { + bool needsNew = source.NodeName != "AstNode"; + + builder.AppendLine($" {(needsNew ? "new " : "")}public static readonly {source.NodeName} Null = new Null{source.NodeName}();"); + + builder.AppendLine($@" + sealed class Null{source.NodeName} : {source.NodeName} + {{ + public override NodeType NodeType => NodeType.Unknown; + + public override bool IsNull => true; + + public override void AcceptVisitor(IAstVisitor visitor) + {{ + visitor.VisitNullNode(this); + }} + + public override T AcceptVisitor(IAstVisitor visitor) + {{ + return visitor.VisitNullNode(this); + }} + + public override S AcceptVisitor(IAstVisitor visitor, T data) + {{ + return visitor.VisitNullNode(this, data); + }} + + protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) + {{ + return other == null || other.IsNull; + }}"); + + if (source.IsTypeNode) + { + builder.AppendLine( + $@" + + public override Decompiler.TypeSystem.ITypeReference ToTypeReference(Resolver.NameLookupMode lookupMode, Decompiler.TypeSystem.InterningProvider? interningProvider = null) + {{ + return Decompiler.TypeSystem.SpecialType.UnknownType; + }}" + ); + } + + if (source.NullNodeBaseCtorParamCount > 0) + { + builder.AppendLine($@" + + public Null{source.NodeName}() : base({string.Join(", ", Enumerable.Repeat("default", source.NullNodeBaseCtorParamCount))}) {{ }}"); + } + + builder.AppendLine($@" + }} + +"); + + } + + if (source.NeedsAcceptImpls && source.NeedsVisitor) + { + builder.Append($@" public override void AcceptVisitor(IAstVisitor visitor) + {{ + visitor.Visit{source.NodeName}(this); + }} + + public override T AcceptVisitor(IAstVisitor visitor) + {{ + return visitor.Visit{source.NodeName}(this); + }} + + public override S AcceptVisitor(IAstVisitor visitor, T data) + {{ + return visitor.Visit{source.NodeName}(this, data); + }} +"); + } + + if (source.MembersToMatch != null) + { + builder.Append($@" protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) + {{ + return other is {source.NodeName} o && !o.IsNull"); + + foreach (var (member, typeName, recursive, hasAny) in source.MembersToMatch) + { + if (member == "MatchAttributesAndModifiers") + { + builder.Append($"\r\n\t\t\t&& this.MatchAttributesAndModifiers(o, match)"); + } + else if (recursive) + { + builder.Append($"\r\n\t\t\t&& this.{member}.DoMatch(o.{member}, match)"); + } + else if (hasAny) + { + builder.Append($"\r\n\t\t\t&& (this.{member} == {typeName}.Any || this.{member} == o.{member})"); + } + else + { + builder.Append($"\r\n\t\t\t&& this.{member} == o.{member}"); + } + } + + builder.Append(@"; + } +"); + } + + builder.AppendLine("}"); + + context.AddSource(source.NodeName + ".g.cs", SourceText.From(builder.ToString(), Encoding.UTF8)); + } + + private void WriteVisitors(SourceProductionContext context, ImmutableArray source) + { + var builder = new StringBuilder(); + + builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); + + source = source + .Concat([new("NullNode", false, true, false, 0, false, "NullNode", "AstNode", null), new("PatternPlaceholder", false, true, false, 0, false, "PatternPlaceholder", "AstNode", null)]) + .ToImmutableArray(); + + WriteInterface("IAstVisitor", "void", ""); + WriteInterface("IAstVisitor", "S", ""); + WriteInterface("IAstVisitor", "S", ", T data"); + + context.AddSource("IAstVisitor.g.cs", SourceText.From(builder.ToString(), Encoding.UTF8)); + + void WriteInterface(string name, string ret, string param) + { + builder.AppendLine($"public interface {name}"); + builder.AppendLine("{"); + + foreach (var type in source.OrderBy(t => t.VisitMethodName)) + { + if (!type.NeedsVisitor) + continue; + + string extParams, paramName; + if (type.VisitMethodName == "PatternPlaceholder") + { + paramName = "placeholder"; + extParams = ", PatternMatching.Pattern pattern" + param; + } + else + { + paramName = char.ToLowerInvariant(type.VisitMethodName[0]) + type.VisitMethodName.Substring(1); + extParams = param; + } + + builder.AppendLine($"\t{ret} Visit{type.VisitMethodName}({type.VisitMethodParamType} {paramName}{extParams});"); + } + + builder.AppendLine("}"); + } + } + + public void Initialize(IncrementalGeneratorInitializationContext context) + { + var astNodeAdditions = context.SyntaxProvider.ForAttributeWithMetadataName( + "ICSharpCode.Decompiler.CSharp.Syntax.DecompilerAstNodeAttribute", + (n, ct) => n is ClassDeclarationSyntax, + GetAstNodeAdditions); + + var visitorMembers = astNodeAdditions.Collect(); + + context.RegisterSourceOutput(astNodeAdditions, WriteGeneratedMembers); + context.RegisterSourceOutput(visitorMembers, WriteVisitors); + } +} + +readonly struct EquatableArray : IEquatable>, IEnumerable + where T : IEquatable +{ + readonly T[] array; + + public EquatableArray(T[] array) + { + this.array = array ?? throw new ArgumentNullException(nameof(array)); + } + + public bool Equals(EquatableArray other) + { + return other.array.AsSpan().SequenceEqual(this.array); + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable)array).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return array.GetEnumerator(); + } +} + +static class EquatableArrayExtensions +{ + public static EquatableArray ToEquatableArray(this List array) where T : IEquatable + { + return new EquatableArray(array.ToArray()); + } +} \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs b/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs new file mode 100644 index 000000000..b730ca53c --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 000000000..6bb2025e4 --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/ICSharpCode.Decompiler.Generators.csproj @@ -0,0 +1,25 @@ + + + + netstandard2.0 + enable + enable + true + 12 + + + + 4.8.0 + + + + + + + + + + + + + diff --git a/ICSharpCode.Decompiler.Generators/IsExternalInit.cs b/ICSharpCode.Decompiler.Generators/IsExternalInit.cs new file mode 100644 index 000000000..7bac4c969 --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/IsExternalInit.cs @@ -0,0 +1,3 @@ +namespace System.Runtime.CompilerServices; + +class IsExternalInit { } diff --git a/ICSharpCode.Decompiler.Generators/RoslynHelpers.cs b/ICSharpCode.Decompiler.Generators/RoslynHelpers.cs new file mode 100644 index 000000000..fa4747f76 --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/RoslynHelpers.cs @@ -0,0 +1,32 @@ +using Microsoft.CodeAnalysis; + +namespace ICSharpCode.Decompiler.Generators; + +public static class RoslynHelpers +{ + public static IEnumerable GetTopLevelTypes(this IAssemblySymbol assembly) + { + foreach (var ns in TreeTraversal.PreOrder(assembly.GlobalNamespace, ns => ns.GetNamespaceMembers())) + { + foreach (var t in ns.GetTypeMembers()) + { + yield return t; + } + } + } + + public static bool IsDerivedFrom(this INamedTypeSymbol type, INamedTypeSymbol baseType) + { + INamedTypeSymbol? t = type; + + while (t != null) + { + if (SymbolEqualityComparer.Default.Equals(t, baseType)) + return true; + + t = t.BaseType; + } + + return false; + } +} diff --git a/ICSharpCode.Decompiler.Generators/TreeTraversal.cs b/ICSharpCode.Decompiler.Generators/TreeTraversal.cs new file mode 100644 index 000000000..4c194383a --- /dev/null +++ b/ICSharpCode.Decompiler.Generators/TreeTraversal.cs @@ -0,0 +1,125 @@ +#nullable enable +// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +namespace ICSharpCode.Decompiler.Generators; + +/// +/// Static helper methods for traversing trees. +/// +internal static class TreeTraversal +{ + /// + /// Converts a tree data structure into a flat list by traversing it in pre-order. + /// + /// The root element of the tree. + /// The function that gets the children of an element. + /// Iterator that enumerates the tree structure in pre-order. + public static IEnumerable PreOrder(T root, Func?> recursion) + { + return PreOrder(new T[] { root }, recursion); + } + + /// + /// Converts a tree data structure into a flat list by traversing it in pre-order. + /// + /// The root elements of the forest. + /// The function that gets the children of an element. + /// Iterator that enumerates the tree structure in pre-order. + public static IEnumerable PreOrder(IEnumerable input, Func?> recursion) + { + Stack> stack = new Stack>(); + try + { + stack.Push(input.GetEnumerator()); + while (stack.Count > 0) + { + while (stack.Peek().MoveNext()) + { + T element = stack.Peek().Current; + yield return element; + IEnumerable? children = recursion(element); + if (children != null) + { + stack.Push(children.GetEnumerator()); + } + } + stack.Pop().Dispose(); + } + } + finally + { + while (stack.Count > 0) + { + stack.Pop().Dispose(); + } + } + } + + /// + /// Converts a tree data structure into a flat list by traversing it in post-order. + /// + /// The root element of the tree. + /// The function that gets the children of an element. + /// Iterator that enumerates the tree structure in post-order. + public static IEnumerable PostOrder(T root, Func?> recursion) + { + return PostOrder(new T[] { root }, recursion); + } + + /// + /// Converts a tree data structure into a flat list by traversing it in post-order. + /// + /// The root elements of the forest. + /// The function that gets the children of an element. + /// Iterator that enumerates the tree structure in post-order. + public static IEnumerable PostOrder(IEnumerable input, Func?> recursion) + { + Stack> stack = new Stack>(); + try + { + stack.Push(input.GetEnumerator()); + while (stack.Count > 0) + { + while (stack.Peek().MoveNext()) + { + T element = stack.Peek().Current; + IEnumerable? children = recursion(element); + if (children != null) + { + stack.Push(children.GetEnumerator()); + } + else + { + yield return element; + } + } + stack.Pop().Dispose(); + if (stack.Count > 0) + yield return stack.Peek().Current; + } + } + finally + { + while (stack.Count > 0) + { + stack.Pop().Dispose(); + } + } + } +} diff --git a/ICSharpCode.Decompiler/packages.lock.json b/ICSharpCode.Decompiler/packages.lock.json index 90d8e948b..5f400a344 100644 --- a/ICSharpCode.Decompiler/packages.lock.json +++ b/ICSharpCode.Decompiler/packages.lock.json @@ -91,6 +91,9 @@ "type": "Transitive", "resolved": "6.0.0", "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" + }, + "icsharpcode.decompiler.generators.attributes": { + "type": "Project" } } } diff --git a/ILSpy.sln b/ILSpy.sln index 27a5a1fd6..4c286d1da 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -44,6 +44,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection 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 @@ -102,6 +106,14 @@ Global {81A30182-3378-4952-8880-F44822390040}.Debug|Any CPU.Build.0 = Debug|Any CPU {81A30182-3378-4952-8880-F44822390040}.Release|Any CPU.ActiveCfg = Release|Any CPU {81A30182-3378-4952-8880-F44822390040}.Release|Any CPU.Build.0 = Release|Any CPU + {0792B524-622B-4B9D-8027-3531ED6A42EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 From 6b429060c647061eeb66c9f026a821935a0a974e Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 22:38:50 +0200 Subject: [PATCH 02/15] Fix a few warnings --- ICSharpCode.Decompiler/IL/Instructions.cs | 4 ++-- ICSharpCode.Decompiler/IL/Instructions.tt | 5 +++-- .../IL/Transforms/TransformDisplayClassUsage.cs | 2 +- .../TypeSystem/Implementation/MetadataTypeDefinition.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs index 4094f9c9e..90cbcc525 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.cs +++ b/ICSharpCode.Decompiler/IL/Instructions.cs @@ -3790,7 +3790,7 @@ namespace ICSharpCode.Decompiler.IL public bool DelayExceptions; // NullReferenceException/IndexOutOfBoundsException only occurs when the reference is dereferenced readonly IField field; /// Returns the field operand. - public IField Field { get { return field; } } + public IField Field { get { return this.field; } } public override StackType ResultType { get { return target.ResultType.IsIntegerType() ? StackType.I : StackType.Ref; } } protected override InstructionFlags ComputeFlags() { @@ -3844,7 +3844,7 @@ namespace ICSharpCode.Decompiler.IL public override StackType ResultType { get { return StackType.Ref; } } readonly IField field; /// Returns the field operand. - public IField Field { get { return field; } } + public IField Field { get { return this.field; } } public override void WriteTo(ITextOutput output, ILAstWritingOptions options) { WriteILRange(output, options); diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt index 8c2a5bf5e..28f40fc27 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.tt +++ b/ICSharpCode.Decompiler/IL/Instructions.tt @@ -862,7 +862,8 @@ namespace ICSharpCode.Decompiler.IL opCode.PerformMatchConditions.Add("Patterns.ListMatch.DoMatch(this." + argProp + ", o." + argProp + ", ref match)"); if (i == 0) opCode.WriteArguments.Add("bool first = true;"); - opCode.WriteArguments.Add("foreach (var " + arg + " in " + argProp + ") {"); + opCode.WriteArguments.Add("foreach (var " + arg + " in " + argProp + ")"); + opCode.WriteArguments.Add("{"); if (i > 0) opCode.WriteArguments.Add("\toutput.Write(\", \");"); else @@ -1087,7 +1088,7 @@ protected override void Disconnected() opCode.MatchParameters.Add(new MatchParamInfo { TypeName = "IField", Name = "field", FieldName = "Field" }); opCode.PerformMatchConditions.Add("field.Equals(o.field)"); opCode.Members.Add("/// Returns the field operand." + Environment.NewLine - + "public IField Field { get { return field; } }"); + + "public IField Field { get { return this.field; } }"); opCode.GenerateWriteTo = true; opCode.WriteOperand.Add("output.Write(' ');"); opCode.WriteOperand.Add("field.WriteTo(output);"); diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs index 103c77d79..32fcb73d3 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformDisplayClassUsage.cs @@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms private readonly IField field; private ILVariable declaredVariable; - public string Name => field.Name; + public string Name => @field.Name; public bool CanPropagate { get; private set; } public bool UsesInitialValue { get; set; } diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs index 632a3e4cc..03e9c5e6c 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs @@ -187,7 +187,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation foreach (FieldDefinitionHandle h in fieldCollection) { var field = metadata.GetFieldDefinition(h); - var attr = field.Attributes; + var attr = @field.Attributes; if (module.IsVisible(attr)) { fieldList.Add(module.GetDefinition(h)); From fa4b82aa1b63146c4d2e24ec0ef06bd3652c5274 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 22:41:04 +0200 Subject: [PATCH 03/15] Fixup 1st commit --- .../IdentifierExpressionBackreference.cs | 10 +++++----- .../ICSharpCode.Decompiler.csproj | 19 ++++++++++++------- 2 files changed, 17 insertions(+), 12 deletions(-) rename ICSharpCode.Decompiler/CSharp/Syntax/{ => PatternMatching}/IdentifierExpressionBackreference.cs (84%) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IdentifierExpressionBackreference.cs similarity index 84% rename from ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs rename to ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IdentifierExpressionBackreference.cs index 78ee9359d..0975b686a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/IdentifierExpressionBackreference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IdentifierExpressionBackreference.cs @@ -19,12 +19,12 @@ using System; using System.Linq; -namespace ICSharpCode.Decompiler.CSharp.Syntax +namespace ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching { /// /// Matches identifier expressions that have the same identifier as the referenced variable/type definition/method definition. /// - public class IdentifierExpressionBackreference : PatternMatching.Pattern + public class IdentifierExpressionBackreference : Pattern { readonly string referencedGroupName; @@ -39,12 +39,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.referencedGroupName = referencedGroupName; } - public override bool DoMatch(PatternMatching.INode other, PatternMatching.Match match) + public override bool DoMatch(INode other, Match match) { - IdentifierExpression ident = other as IdentifierExpression; + var ident = other as IdentifierExpression; if (ident == null || ident.TypeArguments.Any()) return false; - AstNode referenced = (AstNode)match.Get(referencedGroupName).Last(); + var referenced = (AstNode)match.Get(referencedGroupName).Last(); if (referenced == null) return false; return ident.Identifier == referenced.GetChildByRole(Roles.Identifier).Name; diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 0a11c17b9..3f9a51156 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -28,7 +28,7 @@ False false - 11 + preview true True ICSharpCode.Decompiler.snk @@ -99,6 +99,11 @@ + + + + + @@ -109,6 +114,11 @@ + + True + True + Instructions.tt + @@ -229,7 +239,7 @@ - + @@ -507,11 +517,6 @@ - - True - True - Instructions.tt - From b2c8072a0219e85009ba04b7ca6ca15b63a10954 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 22:49:25 +0200 Subject: [PATCH 04/15] Add DecompilerAstNode attributes --- .../CSharp/Syntax/AstNode.cs | 3 +- .../CSharp/Syntax/AstType.cs | 3 +- .../CSharp/Syntax/CSharpModifierToken.cs | 3 +- .../CSharp/Syntax/CSharpTokenNode.cs | 3 +- .../CSharp/Syntax/ComposedType.cs | 6 ++-- .../CSharp/Syntax/DocumentationReference.cs | 3 +- .../Expressions/AnonymousMethodExpression.cs | 3 +- .../AnonymousTypeCreateExpression.cs | 3 +- .../Expressions/ArrayCreateExpression.cs | 3 +- .../Expressions/ArrayInitializerExpression.cs | 3 +- .../CSharp/Syntax/Expressions/AsExpression.cs | 3 +- .../Expressions/AssignmentExpression.cs | 3 +- .../Expressions/BaseReferenceExpression.cs | 3 +- .../Expressions/BinaryOperatorExpression.cs | 3 +- .../Syntax/Expressions/CastExpression.cs | 5 ++-- .../Syntax/Expressions/CheckedExpression.cs | 4 +-- .../Expressions/ConditionalExpression.cs | 5 ++-- .../Expressions/DeclarationExpression.cs | 3 +- .../Expressions/DecompilerAstNodeAttribute.cs | 30 +++++++++++++++++++ .../Expressions/DefaultValueExpression.cs | 3 +- .../Syntax/Expressions/DirectionExpression.cs | 3 +- .../Syntax/Expressions/ErrorExpression.cs | 5 ++-- .../CSharp/Syntax/Expressions/Expression.cs | 3 +- .../Expressions/IdentifierExpression.cs | 3 +- .../Syntax/Expressions/IndexerExpression.cs | 3 +- .../InterpolatedStringExpression.cs | 12 +++++--- .../Expressions/InvocationExpression.cs | 3 +- .../CSharp/Syntax/Expressions/IsExpression.cs | 5 ++-- .../Syntax/Expressions/LambdaExpression.cs | 3 +- .../Expressions/MemberReferenceExpression.cs | 3 +- .../Expressions/NamedArgumentExpression.cs | 3 +- .../Syntax/Expressions/NamedExpression.cs | 3 +- .../Expressions/NullReferenceExpression.cs | 3 +- .../Expressions/ObjectCreateExpression.cs | 3 +- .../OutVarDeclarationExpression.cs | 3 +- .../Expressions/ParenthesizedExpression.cs | 3 +- .../Expressions/PointerReferenceExpression.cs | 3 +- .../Syntax/Expressions/PrimitiveExpression.cs | 5 ++-- .../Syntax/Expressions/QueryExpression.cs | 30 ++++++++++++------- .../Expressions/RecursivePatternExpression.cs | 3 +- .../Syntax/Expressions/SizeOfExpression.cs | 3 +- .../Expressions/StackAllocExpression.cs | 3 +- .../Syntax/Expressions/SwitchExpression.cs | 6 ++-- .../Expressions/ThisReferenceExpression.cs | 3 +- .../Syntax/Expressions/ThrowExpression.cs | 3 +- .../Syntax/Expressions/TupleExpression.cs | 5 ++-- .../Syntax/Expressions/TypeOfExpression.cs | 3 +- .../Expressions/TypeReferenceExpression.cs | 3 +- .../Expressions/UnaryOperatorExpression.cs | 3 +- .../Syntax/Expressions/UncheckedExpression.cs | 3 +- .../Expressions/UndocumentedExpression.cs | 3 +- .../Expressions/WithInitializerExpression.cs | 3 +- .../CSharp/Syntax/FunctionPointerAstType.cs | 3 +- .../CSharp/Syntax/GeneralScope/Attribute.cs | 3 +- .../Syntax/GeneralScope/AttributeSection.cs | 3 +- .../CSharp/Syntax/GeneralScope/Comment.cs | 3 +- .../CSharp/Syntax/GeneralScope/Constraint.cs | 3 +- .../GeneralScope/DelegateDeclaration.cs | 3 +- .../GeneralScope/ExternAliasDeclaration.cs | 3 +- .../GeneralScope/NamespaceDeclaration.cs | 3 +- .../GeneralScope/PreProcessorDirective.cs | 9 ++++-- .../Syntax/GeneralScope/TypeDeclaration.cs | 3 +- .../GeneralScope/TypeParameterDeclaration.cs | 3 +- .../GeneralScope/UsingAliasDeclaration.cs | 3 +- .../Syntax/GeneralScope/UsingDeclaration.cs | 3 +- .../CSharp/Syntax/Identifier.cs | 3 +- .../CSharp/Syntax/InvocationAstType.cs | 5 ++-- .../CSharp/Syntax/MemberType.cs | 3 +- .../CSharp/Syntax/PrimitiveType.cs | 3 +- .../CSharp/Syntax/SimpleType.cs | 3 +- .../Syntax/Statements/BlockStatement.cs | 3 +- .../Syntax/Statements/BreakStatement.cs | 3 +- .../Syntax/Statements/CheckedStatement.cs | 3 +- .../Syntax/Statements/ContinueStatement.cs | 3 +- .../Syntax/Statements/DoWhileStatement.cs | 3 +- .../Syntax/Statements/EmptyStatement.cs | 3 +- .../Syntax/Statements/ExpressionStatement.cs | 3 +- .../Syntax/Statements/FixedStatement.cs | 3 +- .../CSharp/Syntax/Statements/ForStatement.cs | 3 +- .../Syntax/Statements/ForeachStatement.cs | 3 +- .../CSharp/Syntax/Statements/GotoStatement.cs | 9 ++++-- .../Syntax/Statements/IfElseStatement.cs | 3 +- .../Syntax/Statements/LabelStatement.cs | 3 +- .../LocalFunctionDeclarationStatement.cs | 3 +- .../CSharp/Syntax/Statements/LockStatement.cs | 3 +- .../Syntax/Statements/ReturnStatement.cs | 3 +- .../CSharp/Syntax/Statements/Statement.cs | 3 +- .../Syntax/Statements/SwitchStatement.cs | 9 ++++-- .../Syntax/Statements/ThrowStatement.cs | 3 +- .../Syntax/Statements/TryCatchStatement.cs | 6 ++-- .../Syntax/Statements/UncheckedStatement.cs | 3 +- .../Syntax/Statements/UnsafeStatement.cs | 3 +- .../Syntax/Statements/UsingStatement.cs | 3 +- .../VariableDeclarationStatement.cs | 3 +- .../Syntax/Statements/WhileStatement.cs | 3 +- .../Syntax/Statements/YieldBreakStatement.cs | 3 +- .../Syntax/Statements/YieldReturnStatement.cs | 3 +- .../CSharp/Syntax/SyntaxTree.cs | 4 +-- .../CSharp/Syntax/TupleAstType.cs | 7 +++-- .../CSharp/Syntax/TypeMembers/Accessor.cs | 3 +- .../TypeMembers/ConstructorDeclaration.cs | 6 ++-- .../TypeMembers/DestructorDeclaration.cs | 3 +- .../TypeMembers/EnumMemberDeclaration.cs | 3 +- .../Syntax/TypeMembers/EventDeclaration.cs | 6 ++-- .../Syntax/TypeMembers/FieldDeclaration.cs | 3 +- .../TypeMembers/FixedFieldDeclaration.cs | 3 +- .../TypeMembers/FixedVariableInitializer.cs | 3 +- .../Syntax/TypeMembers/IndexerDeclaration.cs | 3 +- .../Syntax/TypeMembers/MethodDeclaration.cs | 3 +- .../Syntax/TypeMembers/OperatorDeclaration.cs | 3 +- .../TypeMembers/ParameterDeclaration.cs | 3 +- .../Syntax/TypeMembers/PropertyDeclaration.cs | 3 +- .../Syntax/TypeMembers/VariableInitializer.cs | 3 +- .../CSharp/Syntax/VariableDesignation.cs | 10 ++++--- 114 files changed, 308 insertions(+), 157 deletions(-) create mode 100644 ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DecompilerAstNodeAttribute.cs diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs index b11edf399..3707b0c4b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs @@ -37,7 +37,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public abstract class AstNode : AbstractAnnotatable, IFreezable, INode, ICloneable + [DecompilerAstNode(true)] + public abstract partial class AstNode : AbstractAnnotatable, IFreezable, INode, ICloneable { // the Root role must be available when creating the null nodes, so we can't put it in the Roles class internal static readonly Role RootRole = new Role("Root", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs index a8b8da53a..7734bc98d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs @@ -28,7 +28,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// A type reference in the C# AST. /// - public abstract class AstType : AstNode + [DecompilerAstNode(true)] + public abstract partial class AstType : AstNode { #region Null public new static readonly AstType Null = new NullAstType(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs index fbe31464d..6ca9ce12d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs @@ -31,7 +31,8 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class CSharpModifierToken : CSharpTokenNode + [DecompilerAstNode(false)] + public partial class CSharpModifierToken : CSharpTokenNode { Modifiers modifier; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs index 6bbf8a546..e12b2ce4c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs @@ -34,7 +34,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// In all non null c# token nodes the Role of a CSharpToken must be a TokenRole. /// - public class CSharpTokenNode : AstNode + [DecompilerAstNode(true)] + public partial class CSharpTokenNode : AstNode { public static new readonly CSharpTokenNode Null = new NullCSharpTokenNode(); class NullCSharpTokenNode : CSharpTokenNode diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs index c042a2ca9..70650fbc7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs @@ -34,7 +34,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class ComposedType : AstType + [DecompilerAstNode(false)] + public partial class ComposedType : AstType { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; public static readonly TokenRole RefRole = new TokenRole("ref"); @@ -230,7 +231,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [,,,] /// - public class ArraySpecifier : AstNode + [DecompilerAstNode(false)] + public partial class ArraySpecifier : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs index 893f015fc..44af88489 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs @@ -23,7 +23,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a 'cref' reference in XML documentation. /// - public class DocumentationReference : AstNode + [DecompilerAstNode(false)] + public partial class DocumentationReference : AstNode { public static readonly Role DeclaringTypeRole = new Role("DeclaringType", AstType.Null); public static readonly Role ConversionOperatorReturnTypeRole = new Role("ConversionOperatorReturnType", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs index 633073b36..30c52c986 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs @@ -32,7 +32,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [async] delegate(Parameters) {Body} /// - public class AnonymousMethodExpression : Expression + [DecompilerAstNode(false)] + public partial class AnonymousMethodExpression : Expression { public readonly static TokenRole DelegateKeywordRole = new TokenRole("delegate"); public readonly static TokenRole AsyncModifierRole = LambdaExpression.AsyncModifierRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs index e74e2e1af..c2793c3f8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new { [ExpressionList] } /// - public class AnonymousTypeCreateExpression : Expression + [DecompilerAstNode(false)] + public partial class AnonymousTypeCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs index e4314f001..84d583916 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs @@ -22,7 +22,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new Type[Dimensions] /// - public class ArrayCreateExpression : Expression + [DecompilerAstNode(false)] + public partial class ArrayCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); public readonly static Role AdditionalArraySpecifierRole = new Role("AdditionalArraySpecifier", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index f9ce09152..0765cbabd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Elements } /// - public class ArrayInitializerExpression : Expression + [DecompilerAstNode(true)] + public partial class ArrayInitializerExpression : Expression { /// /// For ease of use purposes in the resolver the ast representation diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs index b01fd4f86..06c64f84c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression as TypeReference /// - public class AsExpression : Expression + [DecompilerAstNode(false)] + public partial class AsExpression : Expression { public readonly static TokenRole AsKeywordRole = new TokenRole("as"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs index 378b33bfa..af6ac366a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -33,7 +33,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Left Operator= Right /// - public class AssignmentExpression : Expression + [DecompilerAstNode(false)] + public partial class AssignmentExpression : Expression { // reuse roles from BinaryOperatorExpression public readonly static Role LeftRole = BinaryOperatorExpression.LeftRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs index 5084d0e04..48bab380f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// base /// - public class BaseReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class BaseReferenceExpression : Expression { public TextLocation Location { get; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs index 1386e1029..09e414199 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -32,7 +32,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Left Operator Right /// - public class BinaryOperatorExpression : Expression + [DecompilerAstNode(false)] + public partial class BinaryOperatorExpression : Expression { public readonly static TokenRole BitwiseAndRole = new TokenRole("&"); public readonly static TokenRole BitwiseOrRole = new TokenRole("|"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs index f3bd22ec2..670154e06 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs @@ -23,14 +23,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System.Collections.Generic; - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// (CastTo)Expression /// - public class CastExpression : Expression + [DecompilerAstNode(false)] + public partial class CastExpression : Expression { public CSharpTokenNode LParToken { get { return GetChildByRole(Roles.LPar); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs index baff6c51a..098f1d44f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs @@ -24,13 +24,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// checked(Expression) /// - public class CheckedExpression : Expression + [DecompilerAstNode(false)] + public partial class CheckedExpression : Expression { public readonly static TokenRole CheckedKeywordRole = new TokenRole("checked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs index a1576e5cc..33ff6906f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -23,14 +23,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System.Collections.Generic; - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Condition ? TrueExpression : FalseExpression /// - public class ConditionalExpression : Expression + [DecompilerAstNode(false)] + public partial class ConditionalExpression : Expression { public readonly static Role ConditionRole = Roles.Condition; public readonly static TokenRole QuestionMarkRole = new TokenRole("?"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs index 558456524..5254405fb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs @@ -23,7 +23,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// TypeName VariableDesignation /// - public class DeclarationExpression : Expression + [DecompilerAstNode(false)] + public partial class DeclarationExpression : Expression { public AstType Type { get { return GetChildByRole(Roles.Type); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DecompilerAstNodeAttribute.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DecompilerAstNodeAttribute.cs new file mode 100644 index 000000000..a0dd2b2ae --- /dev/null +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DecompilerAstNodeAttribute.cs @@ -0,0 +1,30 @@ +// Copyright (c) 2017 Siegfried Pammer +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + + + + + + + +namespace ICSharpCode.Decompiler.CSharp.Syntax +{ + class DecompilerAstNodeAttribute : System.Attribute + { + } +} \ No newline at end of file diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs index 372325a40..b11368059 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// default(Type) /// - public class DefaultValueExpression : Expression + [DecompilerAstNode(false)] + public partial class DefaultValueExpression : Expression { public readonly static TokenRole DefaultKeywordRole = new TokenRole("default"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs index e92115530..f675384ac 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs @@ -38,7 +38,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ref Expression /// - public class DirectionExpression : Expression + [DecompilerAstNode(false)] + public partial class DirectionExpression : Expression { public readonly static TokenRole RefKeywordRole = new TokenRole("ref"); public readonly static TokenRole OutKeywordRole = new TokenRole("out"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs index 89f9fcfdd..4314e12db 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -23,11 +23,10 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; - namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class ErrorExpression : Expression + [DecompilerAstNode(false)] + public partial class ErrorExpression : Expression { public TextLocation Location { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs index c5d73352e..d48092512 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs @@ -28,7 +28,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be an expression" /// - public abstract class Expression : AstNode + [DecompilerAstNode(true)] + public abstract partial class Expression : AstNode { #region Null public new static readonly Expression Null = new NullExpression(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs index 76fc8c2a5..45d7a2694 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -26,7 +26,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class IdentifierExpression : Expression + [DecompilerAstNode(false)] + public partial class IdentifierExpression : Expression { public IdentifierExpression() { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs index e688b2a74..5d083c0b7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target[Arguments] /// - public class IndexerExpression : Expression + [DecompilerAstNode(false)] + public partial class IndexerExpression : Expression { public Expression Target { get { return GetChildByRole(Roles.TargetExpression); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs index 562755a0a..96f3c987b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -6,7 +6,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class InterpolatedStringExpression : Expression + [DecompilerAstNode(false)] + public partial class InterpolatedStringExpression : Expression { public static readonly TokenRole OpenQuote = new TokenRole("$\""); public static readonly TokenRole CloseQuote = new TokenRole("\""); @@ -47,7 +48,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public abstract class InterpolatedStringContent : AstNode + [DecompilerAstNode(true)] + public abstract partial class InterpolatedStringContent : AstNode { #region Null public new static readonly InterpolatedStringContent Null = new NullInterpolatedStringContent(); @@ -90,7 +92,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Expression , Alignment : Suffix } /// - public class Interpolation : InterpolatedStringContent + [DecompilerAstNode(false)] + public partial class Interpolation : InterpolatedStringContent { public static readonly TokenRole LBrace = new TokenRole("{"); public static readonly TokenRole RBrace = new TokenRole("}"); @@ -146,7 +149,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class InterpolatedStringText : InterpolatedStringContent + [DecompilerAstNode(false)] + public partial class InterpolatedStringText : InterpolatedStringContent { public string Text { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs index 3ed91cefc..3e5804fe6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target(Arguments) /// - public class InvocationExpression : Expression + [DecompilerAstNode(false)] + public partial class InvocationExpression : Expression { public Expression Target { get { return GetChildByRole(Roles.TargetExpression); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs index fa1bea0bc..158e709fc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs @@ -23,14 +23,13 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System.Collections.Generic; - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// /// Expression is Type /// - public class IsExpression : Expression + [DecompilerAstNode(false)] + public partial class IsExpression : Expression { public readonly static TokenRole IsKeywordRole = new TokenRole("is"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs index 8782aa1d8..ca5e8724a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs @@ -29,7 +29,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [async] Parameters => Body /// - public class LambdaExpression : Expression + [DecompilerAstNode(false)] + public partial class LambdaExpression : Expression { public static readonly Role AttributeRole = new Role("Attribute", null); public readonly static TokenRole AsyncModifierRole = new TokenRole("async"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs index fcda03b54..a816a4322 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target.MemberName /// - public class MemberReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class MemberReferenceExpression : Expression { public Expression Target { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs index 5f3fb3627..c1121f03a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs @@ -23,7 +23,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents a named argument passed to a method or attribute. /// name: expression /// - public class NamedArgumentExpression : Expression + [DecompilerAstNode(false)] + public partial class NamedArgumentExpression : Expression { public NamedArgumentExpression() { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs index d8fe23df8..64438c19a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs @@ -32,7 +32,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This isn't the same as 'assign' even though it has the same syntax. /// This expression is used in object initializers and for named attribute arguments [Attr(FieldName = value)]. /// - public class NamedExpression : Expression + [DecompilerAstNode(false)] + public partial class NamedExpression : Expression { public NamedExpression() { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs index ee67fb20f..c2f2bbaa1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// null /// - public class NullReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class NullReferenceExpression : Expression { TextLocation location; public override TextLocation StartLocation { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs index f559f6a89..4729341f0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new Type(Arguments) { Initializer } /// - public class ObjectCreateExpression : Expression + [DecompilerAstNode(false)] + public partial class ObjectCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); public readonly static Role InitializerRole = ArrayCreateExpression.InitializerRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs index 022987e80..70cc5f21b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs @@ -21,7 +21,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// out type expression /// - public class OutVarDeclarationExpression : Expression + [DecompilerAstNode(false)] + public partial class OutVarDeclarationExpression : Expression { public readonly static TokenRole OutKeywordRole = DirectionExpression.OutKeywordRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs index b662ab3d4..f08490a0a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ( Expression ) /// - public class ParenthesizedExpression : Expression + [DecompilerAstNode(false)] + public partial class ParenthesizedExpression : Expression { public CSharpTokenNode LParToken { get { return GetChildByRole(Roles.LPar); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs index d678cdaf8..1aa8f5592 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target->MemberName /// - public class PointerReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class PointerReferenceExpression : Expression { public readonly static TokenRole ArrowRole = new TokenRole("->"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs index a1e8fcc3b..ddf82ffc0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs @@ -24,8 +24,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; - using ICSharpCode.Decompiler.Util; namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -48,7 +46,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a literal value. /// - public class PrimitiveExpression : Expression + [DecompilerAstNode(false)] + public partial class PrimitiveExpression : Expression { public static readonly object AnyValue = new object(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs index 87315b01f..1c9ba8f5a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -18,7 +18,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class QueryExpression : Expression + [DecompilerAstNode(true)] + public partial class QueryExpression : Expression { public static readonly Role ClauseRole = new Role("Clause", null); @@ -106,7 +107,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// new QuerySelectClause(e) /// } /// - public class QueryContinuationClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryContinuationClause : QueryClause { public static readonly Role PrecedingQueryRole = new Role("PrecedingQuery", QueryExpression.Null); public static readonly TokenRole IntoKeywordRole = new TokenRole("into"); @@ -155,7 +157,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class QueryFromClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryFromClause : QueryClause { public static readonly TokenRole FromKeywordRole = new TokenRole("from"); public static readonly TokenRole InKeywordRole = new TokenRole("in"); @@ -214,7 +217,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class QueryLetClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryLetClause : QueryClause { public readonly static TokenRole LetKeywordRole = new TokenRole("let"); @@ -267,7 +271,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } - public class QueryWhereClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryWhereClause : QueryClause { public readonly static TokenRole WhereKeywordRole = new TokenRole("where"); @@ -305,7 +310,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a join or group join clause. /// - public class QueryJoinClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryJoinClause : QueryClause { public static readonly TokenRole JoinKeywordRole = new TokenRole("join"); public static readonly Role TypeRole = Roles.Type; @@ -415,7 +421,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class QueryOrderClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryOrderClause : QueryClause { public static readonly TokenRole OrderbyKeywordRole = new TokenRole("orderby"); public static readonly Role OrderingRole = new Role("Ordering", null); @@ -450,7 +457,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class QueryOrdering : AstNode + [DecompilerAstNode(false)] + public partial class QueryOrdering : AstNode { public readonly static TokenRole AscendingKeywordRole = new TokenRole("ascending"); public readonly static TokenRole DescendingKeywordRole = new TokenRole("descending"); @@ -502,7 +510,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Descending } - public class QuerySelectClause : QueryClause + [DecompilerAstNode(false)] + public partial class QuerySelectClause : QueryClause { public readonly static TokenRole SelectKeywordRole = new TokenRole("select"); @@ -537,7 +546,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class QueryGroupClause : QueryClause + [DecompilerAstNode(false)] + public partial class QueryGroupClause : QueryClause { public static readonly TokenRole GroupKeywordRole = new TokenRole("group"); public static readonly Role ProjectionRole = new Role("Projection", Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs index 3a26d735b..f0f7a1d25 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs @@ -20,7 +20,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class RecursivePatternExpression : Expression + [DecompilerAstNode(false)] + public partial class RecursivePatternExpression : Expression { public static readonly Role SubPatternRole = new Role("SubPattern", Syntax.Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs index b5daa0a9f..6a3acb9c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// sizeof(Type) /// - public class SizeOfExpression : Expression + [DecompilerAstNode(false)] + public partial class SizeOfExpression : Expression { public readonly static TokenRole SizeofKeywordRole = new TokenRole("sizeof"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs index f3c1c9b85..0ea2cdf13 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// stackalloc Type[Count] /// - public class StackAllocExpression : Expression + [DecompilerAstNode(false)] + public partial class StackAllocExpression : Expression { public readonly static TokenRole StackallocKeywordRole = new TokenRole("stackalloc"); public readonly static Role InitializerRole = new Role("Initializer", ArrayInitializerExpression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs index ca66a0796..c1af952a0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs @@ -22,7 +22,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression switch { SwitchSections } /// - public class SwitchExpression : Expression + [DecompilerAstNode(false)] + public partial class SwitchExpression : Expression { public static readonly TokenRole SwitchKeywordRole = new TokenRole("switch"); public static readonly Role SwitchSectionRole = new Role("SwitchSection", null); @@ -73,7 +74,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Pattern => Expression /// - public class SwitchExpressionSection : AstNode + [DecompilerAstNode(false)] + public partial class SwitchExpressionSection : AstNode { public static readonly Role PatternRole = new Role("Pattern", Expression.Null); public static readonly Role BodyRole = new Role("Body", Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs index db61e2dad..4eb91600e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// this /// - public class ThisReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class ThisReferenceExpression : Expression { public TextLocation Location { get; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs index 736d2da6d..4a3db6ac0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs @@ -21,7 +21,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// throw Expression /// - public class ThrowExpression : Expression + [DecompilerAstNode(false)] + public partial class ThrowExpression : Expression { public static readonly TokenRole ThrowKeywordRole = ThrowStatement.ThrowKeywordRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs index 143726af4..4840266c0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs @@ -16,13 +16,12 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System; - using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class TupleExpression : Expression + [DecompilerAstNode(false)] + public partial class TupleExpression : Expression { public AstNodeCollection Elements { get { return GetChildrenByRole(Roles.Expression); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs index b6605ab63..02ec435ef 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// typeof(Type) /// - public class TypeOfExpression : Expression + [DecompilerAstNode(false)] + public partial class TypeOfExpression : Expression { public readonly static TokenRole TypeofKeywordRole = new TokenRole("typeof"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs index 57c8ea9fa..5395e3665 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs @@ -23,7 +23,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents an AstType as an expression. /// This is used when calling a method on a primitive type: "int.Parse()" /// - public class TypeReferenceExpression : Expression + [DecompilerAstNode(false)] + public partial class TypeReferenceExpression : Expression { public AstType Type { get { return GetChildByRole(Roles.Type); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs index 460f9a421..71ce2714a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs @@ -32,7 +32,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Operator Expression /// - public class UnaryOperatorExpression : Expression + [DecompilerAstNode(false)] + public partial class UnaryOperatorExpression : Expression { public readonly static TokenRole NotRole = new TokenRole("!"); public readonly static TokenRole BitNotRole = new TokenRole("~"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs index aa8160127..1ff20d9a0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unchecked(Expression) /// - public class UncheckedExpression : Expression + [DecompilerAstNode(false)] + public partial class UncheckedExpression : Expression { public readonly static TokenRole UncheckedKeywordRole = new TokenRole("unchecked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs index 7de290d8d..31d6c1528 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs @@ -39,7 +39,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents undocumented expressions. /// - public class UndocumentedExpression : Expression + [DecompilerAstNode(false)] + public partial class UndocumentedExpression : Expression { public readonly static TokenRole ArglistKeywordRole = new TokenRole("__arglist"); public readonly static TokenRole RefvalueKeywordRole = new TokenRole("__refvalue"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs index 809dfb367..b616f3f06 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs @@ -23,7 +23,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression with Initializer /// - public class WithInitializerExpression : Expression + [DecompilerAstNode(false)] + public partial class WithInitializerExpression : Expression { public readonly static TokenRole WithKeywordRole = new TokenRole("with"); public readonly static Role InitializerRole = ArrayCreateExpression.InitializerRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs index 96aee3ee9..71dca2f48 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs @@ -31,7 +31,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class FunctionPointerAstType : AstType + [DecompilerAstNode(false)] + public partial class FunctionPointerAstType : AstType { public static readonly TokenRole PointerRole = new TokenRole("*"); public static readonly Role CallingConventionRole = new Role("CallConv", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs index b07bca2b2..c7b4e7617 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Attribute(Arguments) /// - public class Attribute : AstNode + [DecompilerAstNode(false)] + public partial class Attribute : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs index cf8658fe0..26113d93c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [AttributeTarget: Attributes] /// - public class AttributeSection : AstNode + [DecompilerAstNode(false)] + public partial class AttributeSection : AstNode { #region PatternPlaceholder public static implicit operator AttributeSection(PatternMatching.Pattern pattern) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs index b2a84f0ff..d9d00f958 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs @@ -51,7 +51,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax MultiLineDocumentation } - public class Comment : AstNode + [DecompilerAstNode(false)] + public partial class Comment : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs index 4b0c18618..9111b74a1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs @@ -33,7 +33,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new(), struct and class constraints are represented using a PrimitiveType "new", "struct" or "class" /// - public class Constraint : AstNode + [DecompilerAstNode(true)] + public partial class Constraint : AstNode { public override NodeType NodeType { get { return NodeType.Unknown; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs index 0d85f5a59..975e461e3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// delegate ReturnType Name<TypeParameters>(Parameters) where Constraints; /// - public class DelegateDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class DelegateDeclaration : EntityDeclaration { public override NodeType NodeType { get { return NodeType.TypeDeclaration; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs index 353e71f2c..a1031ce48 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// extern alias IDENTIFIER; /// - public class ExternAliasDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class ExternAliasDeclaration : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs index b41e9f882..5446cadc7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// namespace Name { Members } /// - public class NamespaceDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class NamespaceDeclaration : AstNode { public static readonly Role MemberRole = SyntaxTree.MemberRole; public static readonly Role NamespaceNameRole = new Role("NamespaceName", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs index a1b175d1c..05170720f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs @@ -46,7 +46,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Line = 12 } - public class LinePreprocessorDirective : PreProcessorDirective + [DecompilerAstNode(false)] + public partial class LinePreprocessorDirective : PreProcessorDirective { public int LineNumber { get; @@ -67,7 +68,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class PragmaWarningPreprocessorDirective : PreProcessorDirective + [DecompilerAstNode(false)] + public partial class PragmaWarningPreprocessorDirective : PreProcessorDirective { public static readonly Role WarningRole = new Role("Warning", null); @@ -125,7 +127,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class PreProcessorDirective : AstNode + [DecompilerAstNode(false)] + public partial class PreProcessorDirective : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs index a60d12843..6d2e99d5c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs @@ -47,7 +47,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// class Name<TypeParameters> : BaseTypes where Constraints; /// - public class TypeDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class TypeDeclaration : EntityDeclaration { public override NodeType NodeType { get { return NodeType.TypeDeclaration; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs index db5c622cf..8c5305c48 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Note: mirroring the C# syntax, constraints are not part of the type parameter declaration, but belong /// to the parent type or method. /// - public class TypeParameterDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class TypeParameterDeclaration : AstNode { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; public static readonly TokenRole OutVarianceKeywordRole = new TokenRole("out"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs index 1b3ab140f..9f1668526 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// using Alias = Import; /// - public class UsingAliasDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class UsingAliasDeclaration : AstNode { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); public static readonly Role AliasRole = new Role("Alias", Identifier.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs index d7246003c..bd978ca3d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs @@ -32,7 +32,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// using Import; /// - public class UsingDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class UsingDeclaration : AstNode { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); public static readonly Role ImportRole = new Role("Import", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs index 726c939fb..e4f1cc784 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -28,7 +28,8 @@ using System; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class Identifier : AstNode + [DecompilerAstNode(true)] + public partial class Identifier : AstNode { public new static readonly Identifier Null = new NullIdentifier(); sealed class NullIdentifier : Identifier diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs index 5dddbfb56..7c19e40f8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs @@ -17,8 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; -using System.Text; using ICSharpCode.Decompiler.CSharp.Resolver; using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; @@ -29,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// BaseType "(" Argument { "," Argument } ")" /// - public class InvocationAstType : AstType + [DecompilerAstNode(false)] + public partial class InvocationAstType : AstType { public AstNodeCollection Arguments { get { return GetChildrenByRole(Roles.Expression); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs index 00abace78..a72d94e6b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs @@ -32,7 +32,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class MemberType : AstType + [DecompilerAstNode(false)] + public partial class MemberType : AstType { public static readonly Role TargetRole = new Role("Target", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs index a6f112542..2e1e54cf0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs @@ -33,7 +33,8 @@ using ICSharpCode.Decompiler.TypeSystem.Implementation; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class PrimitiveType : AstType + [DecompilerAstNode(false)] + public partial class PrimitiveType : AstType { TextLocation location; string keyword = string.Empty; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs index 17a19e345..0f655465f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -32,7 +32,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class SimpleType : AstType + [DecompilerAstNode(true)] + public partial class SimpleType : AstType { #region Null public new static readonly SimpleType Null = new NullSimpleType(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index 9965c7af9..5ec485397 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Statements } /// - public class BlockStatement : Statement, IEnumerable + [DecompilerAstNode(true)] + public partial class BlockStatement : Statement, IEnumerable { public static readonly Role StatementRole = new Role("Statement", Statement.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs index df8732e81..89f96a886 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// break; /// - public class BreakStatement : Statement + [DecompilerAstNode(false)] + public partial class BreakStatement : Statement { public static readonly TokenRole BreakKeywordRole = new TokenRole("break"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs index c701dcfc5..e70642fc3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// checked BodyBlock /// - public class CheckedStatement : Statement + [DecompilerAstNode(false)] + public partial class CheckedStatement : Statement { public static readonly TokenRole CheckedKeywordRole = new TokenRole("checked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs index a4b8abacf..9d955f833 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// continue; /// - public class ContinueStatement : Statement + [DecompilerAstNode(false)] + public partial class ContinueStatement : Statement { public static readonly TokenRole ContinueKeywordRole = new TokenRole("continue"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs index ce05ff6b6..ab90c2022 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "do EmbeddedStatement while(Condition);" /// - public class DoWhileStatement : Statement + [DecompilerAstNode(false)] + public partial class DoWhileStatement : Statement { public static readonly TokenRole DoKeywordRole = new TokenRole("do"); public static readonly TokenRole WhileKeywordRole = new TokenRole("while"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs index c76016963..c1f5e0e18 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ; /// - public class EmptyStatement : Statement + [DecompilerAstNode(false)] + public partial class EmptyStatement : Statement { public TextLocation Location { get; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs index 5a4f2a413..f62adb0b4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression; /// - public class ExpressionStatement : Statement + [DecompilerAstNode(false)] + public partial class ExpressionStatement : Statement { public Expression Expression { get { return GetChildByRole(Roles.Expression); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs index 3b34ea2fb..6f0b7f0d3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// fixed (Type Variables) EmbeddedStatement /// - public class FixedStatement : Statement + [DecompilerAstNode(false)] + public partial class FixedStatement : Statement { public static readonly TokenRole FixedKeywordRole = new TokenRole("fixed"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs index 91784f0d4..564099a28 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// for (Initializers; Condition; Iterators) EmbeddedStatement /// - public class ForStatement : Statement + [DecompilerAstNode(false)] + public partial class ForStatement : Statement { public static readonly TokenRole ForKeywordRole = new TokenRole("for"); public readonly static Role InitializerRole = new Role("Initializer", Statement.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs index a01bc05de..52bf294fe 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// foreach (Type VariableName in InExpression) EmbeddedStatement /// - public class ForeachStatement : Statement + [DecompilerAstNode(false)] + public partial class ForeachStatement : Statement { public static readonly TokenRole AwaitRole = UnaryOperatorExpression.AwaitRole; public static readonly TokenRole ForeachKeywordRole = new TokenRole("foreach"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs index b1b064c01..4a8edede1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "goto Label;" /// - public class GotoStatement : Statement + [DecompilerAstNode(false)] + public partial class GotoStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); @@ -88,7 +89,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// or "goto case LabelExpression;" /// - public class GotoCaseStatement : Statement + [DecompilerAstNode(false)] + public partial class GotoCaseStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); public static readonly TokenRole CaseKeywordRole = new TokenRole("case"); @@ -138,7 +140,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// or "goto default;" /// - public class GotoDefaultStatement : Statement + [DecompilerAstNode(false)] + public partial class GotoDefaultStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); public static readonly TokenRole DefaultKeywordRole = new TokenRole("default"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs index fece09f10..983edb058 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// if (Condition) TrueStatement else FalseStatement /// - public class IfElseStatement : Statement + [DecompilerAstNode(false)] + public partial class IfElseStatement : Statement { public readonly static TokenRole IfKeywordRole = new TokenRole("if"); public readonly static Role ConditionRole = Roles.Condition; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs index ca56ec478..fe95941c3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Label: /// - public class LabelStatement : Statement + [DecompilerAstNode(false)] + public partial class LabelStatement : Statement { public string Label { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs index da2d1550f..e98b7afd1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs @@ -20,7 +20,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class LocalFunctionDeclarationStatement : Statement + [DecompilerAstNode(false)] + public partial class LocalFunctionDeclarationStatement : Statement { public static readonly Role MethodDeclarationRole = new Role("Method", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs index a8f25c579..fc3ccc4a8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// lock (Expression) EmbeddedStatement; /// - public class LockStatement : Statement + [DecompilerAstNode(false)] + public partial class LockStatement : Statement { public static readonly TokenRole LockKeywordRole = new TokenRole("lock"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs index 75b96f4fe..d16609501 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// return Expression; /// - public class ReturnStatement : Statement + [DecompilerAstNode(false)] + public partial class ReturnStatement : Statement { public static readonly TokenRole ReturnKeywordRole = new TokenRole("return"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs index b278d1e3f..17910c1e8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be a statement" /// - public abstract class Statement : AstNode + [DecompilerAstNode(true)] + public abstract partial class Statement : AstNode { #region Null public new static readonly Statement Null = new NullStatement(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs index a3412d1c8..ce0a1b358 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// switch (Expression) { SwitchSections } /// - public class SwitchStatement : Statement + [DecompilerAstNode(false)] + public partial class SwitchStatement : Statement { public static readonly TokenRole SwitchKeywordRole = new TokenRole("switch"); public static readonly Role SwitchSectionRole = new Role("SwitchSection", null); @@ -86,7 +87,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class SwitchSection : AstNode + [DecompilerAstNode(false)] + public partial class SwitchSection : AstNode { #region PatternPlaceholder public static implicit operator SwitchSection(PatternMatching.Pattern pattern) @@ -172,7 +174,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class CaseLabel : AstNode + [DecompilerAstNode(false)] + public partial class CaseLabel : AstNode { public static readonly TokenRole CaseKeywordRole = new TokenRole("case"); public static readonly TokenRole DefaultKeywordRole = new TokenRole("default"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs index a16d67a34..9f6b9b846 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// throw Expression; /// - public class ThrowStatement : Statement + [DecompilerAstNode(false)] + public partial class ThrowStatement : Statement { public static readonly TokenRole ThrowKeywordRole = new TokenRole("throw"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index f3ad325bc..2d985057f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// try TryBlock CatchClauses finally FinallyBlock /// - public class TryCatchStatement : Statement + [DecompilerAstNode(false)] + public partial class TryCatchStatement : Statement { public static readonly TokenRole TryKeywordRole = new TokenRole("try"); public static readonly Role TryBlockRole = new Role("TryBlock", BlockStatement.Null); @@ -85,7 +86,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// catch (Type VariableName) { Body } /// - public class CatchClause : AstNode + [DecompilerAstNode(true)] + public partial class CatchClause : AstNode { public static readonly TokenRole CatchKeywordRole = new TokenRole("catch"); public static readonly TokenRole WhenKeywordRole = new TokenRole("when"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs index f24f7213e..a74cf056b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unchecked BodyBlock /// - public class UncheckedStatement : Statement + [DecompilerAstNode(false)] + public partial class UncheckedStatement : Statement { public static readonly TokenRole UncheckedKeywordRole = new TokenRole("unchecked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs index 1a977d5b9..db4dc067a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unsafe { Body } /// - public class UnsafeStatement : Statement + [DecompilerAstNode(false)] + public partial class UnsafeStatement : Statement { public static readonly TokenRole UnsafeKeywordRole = new TokenRole("unsafe"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs index 33bf9d839..45c0d5369 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [ await ] using (ResourceAcquisition) EmbeddedStatement /// - public class UsingStatement : Statement + [DecompilerAstNode(false)] + public partial class UsingStatement : Statement { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); public static readonly TokenRole AwaitRole = UnaryOperatorExpression.AwaitRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs index 1a6066f17..8d4daa5b0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class VariableDeclarationStatement : Statement + [DecompilerAstNode(false)] + public partial class VariableDeclarationStatement : Statement { public static readonly Role ModifierRole = EntityDeclaration.ModifierRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs index 3e852e35d..33d01c4a9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "while (Condition) EmbeddedStatement" /// - public class WhileStatement : Statement + [DecompilerAstNode(false)] + public partial class WhileStatement : Statement { public static readonly TokenRole WhileKeywordRole = new TokenRole("while"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs index 4a777afa9..96cec086b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// yield break; /// - public class YieldBreakStatement : Statement + [DecompilerAstNode(false)] + public partial class YieldBreakStatement : Statement { public static readonly TokenRole YieldKeywordRole = new TokenRole("yield"); public static readonly TokenRole BreakKeywordRole = new TokenRole("break"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs index 235201ab2..d562f1859 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// yield return Expression; /// - public class YieldReturnStatement : Statement + [DecompilerAstNode(false)] + public partial class YieldReturnStatement : Statement { public static readonly TokenRole YieldKeywordRole = new TokenRole("yield"); public static readonly TokenRole ReturnKeywordRole = new TokenRole("return"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs index 92e3bb63d..1187e8e4e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs @@ -26,12 +26,12 @@ using System.Collections.Generic; -using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.Util; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class SyntaxTree : AstNode + [DecompilerAstNode(false)] + public partial class SyntaxTree : AstNode { public static readonly Role MemberRole = new Role("Member", AstNode.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs index 16f5cd4aa..2221d2ecf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -16,7 +16,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System; using System.Collections.Immutable; using System.Linq; @@ -26,7 +25,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class TupleAstType : AstType + [DecompilerAstNode(false)] + public partial class TupleAstType : AstType { public static readonly Role ElementRole = new Role("Element", TupleTypeElement.Null); @@ -63,7 +63,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class TupleTypeElement : AstNode + [DecompilerAstNode(true)] + public partial class TupleTypeElement : AstNode { #region Null public new static readonly TupleTypeElement Null = new TupleTypeElement(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs index def135ba9..12eeb08af 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs @@ -31,7 +31,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// get/set/init/add/remove /// - public class Accessor : EntityDeclaration + [DecompilerAstNode(true)] + public partial class Accessor : EntityDeclaration { public static readonly new Accessor Null = new NullAccessor(); sealed class NullAccessor : Accessor diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index 890b77088..a95a66cbb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -28,7 +28,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class ConstructorDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class ConstructorDeclaration : EntityDeclaration { public static readonly Role InitializerRole = new Role("Initializer", ConstructorInitializer.Null); @@ -92,7 +93,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax This } - public class ConstructorInitializer : AstNode + [DecompilerAstNode(true)] + public partial class ConstructorInitializer : AstNode { public static readonly TokenRole BaseKeywordRole = new TokenRole("base"); public static readonly TokenRole ThisKeywordRole = new TokenRole("this"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs index 5039831ee..d43276938 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs @@ -28,7 +28,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class DestructorDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class DestructorDeclaration : EntityDeclaration { public static readonly TokenRole TildeRole = new TokenRole("~"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs index cbf983454..a3726e150 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs @@ -28,7 +28,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class EnumMemberDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class EnumMemberDeclaration : EntityDeclaration { public static readonly Role InitializerRole = new Role("Initializer", Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs index 1abb7c739..24a752831 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -31,7 +31,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class EventDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class EventDeclaration : EntityDeclaration { public static readonly TokenRole EventKeywordRole = new TokenRole("event"); @@ -84,7 +85,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public class CustomEventDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class CustomEventDeclaration : EntityDeclaration { public static readonly TokenRole EventKeywordRole = new TokenRole("event"); public static readonly TokenRole AddKeywordRole = new TokenRole("add"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs index 548b0333e..553b241bf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs @@ -31,7 +31,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class FieldDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class FieldDeclaration : EntityDeclaration { public override SymbolKind SymbolKind { get { return SymbolKind.Field; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs index 2d31d86ab..9694d54fa 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs @@ -27,7 +27,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class FixedFieldDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class FixedFieldDeclaration : EntityDeclaration { public static readonly TokenRole FixedKeywordRole = new TokenRole("fixed"); public static readonly Role VariableRole = new Role("FixedVariable", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs index 56c602300..8fe3fc4b5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs @@ -30,7 +30,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Name [ CountExpression ] /// - public class FixedVariableInitializer : AstNode + [DecompilerAstNode(false)] + public partial class FixedVariableInitializer : AstNode { public override NodeType NodeType { get { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs index bad5ce81b..ead89ba5e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -31,7 +31,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class IndexerDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class IndexerDeclaration : EntityDeclaration { public static readonly TokenRole ThisKeywordRole = new TokenRole("this"); public static readonly Role GetterRole = PropertyDeclaration.GetterRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs index d01822868..27d213f81 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -28,7 +28,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class MethodDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class MethodDeclaration : EntityDeclaration { public override SymbolKind SymbolKind { get { return SymbolKind.Method; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs index 9ffc9058b..7694d05f4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -76,7 +76,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax CheckedExplicit } - public class OperatorDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class OperatorDeclaration : EntityDeclaration { public static readonly TokenRole OperatorKeywordRole = new TokenRole("operator"); public static readonly TokenRole CheckedKeywordRole = new TokenRole("checked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs index 98a86fd69..fe1eb1ade 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -30,7 +30,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class ParameterDeclaration : AstNode + [DecompilerAstNode(false)] + public partial class ParameterDeclaration : AstNode { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; public static readonly TokenRole ThisModifierRole = new TokenRole("this"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs index f7fd87434..f4e5d8ddc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -28,7 +28,8 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class PropertyDeclaration : EntityDeclaration + [DecompilerAstNode(false)] + public partial class PropertyDeclaration : EntityDeclaration { public static readonly TokenRole GetKeywordRole = new TokenRole("get"); public static readonly TokenRole SetKeywordRole = new TokenRole("set"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index d5b74faa8..2b547c1de 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -27,7 +27,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - public class VariableInitializer : AstNode + [DecompilerAstNode(true)] + public partial class VariableInitializer : AstNode { #region Null public new static readonly VariableInitializer Null = new NullVariableInitializer(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs index 8d7991dec..9cef6f308 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -20,7 +20,8 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - public abstract class VariableDesignation : AstNode + [DecompilerAstNode(true)] + public abstract partial class VariableDesignation : AstNode { public override NodeType NodeType => NodeType.Unknown; @@ -62,9 +63,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Identifier /// - public class SingleVariableDesignation : VariableDesignation + [DecompilerAstNode(false)] + public partial class SingleVariableDesignation : VariableDesignation { - public string Identifier { get { return GetChildByRole(Roles.Identifier).Name; } set { SetChildByRole(Roles.Identifier, Syntax.Identifier.Create(value)); } @@ -99,7 +100,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ( VariableDesignation (, VariableDesignation)* ) /// - public class ParenthesizedVariableDesignation : VariableDesignation + [DecompilerAstNode(false)] + public partial class ParenthesizedVariableDesignation : VariableDesignation { public CSharpTokenNode LParToken { From 2f9a57f41a54e498fa3a6fea8ebf396911e8f27a Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 22:51:47 +0200 Subject: [PATCH 05/15] Delete Null Objects --- .../CSharp/Syntax/AstNode.cs | 39 ------------------- .../CSharp/Syntax/AstType.cs | 38 ------------------ .../CSharp/Syntax/CSharpTokenNode.cs | 34 ---------------- .../Expressions/ArrayInitializerExpression.cs | 33 ---------------- .../CSharp/Syntax/Expressions/Expression.cs | 34 ---------------- .../InterpolatedStringExpression.cs | 37 +----------------- .../Syntax/Expressions/QueryExpression.cs | 33 ---------------- .../CSharp/Syntax/Identifier.cs | 30 -------------- .../CSharp/Syntax/SimpleType.cs | 38 ------------------ .../Syntax/Statements/BlockStatement.cs | 32 --------------- .../CSharp/Syntax/Statements/Statement.cs | 33 ---------------- .../Syntax/Statements/TryCatchStatement.cs | 33 ---------------- .../CSharp/Syntax/TupleAstType.cs | 33 ---------------- .../CSharp/Syntax/TypeMembers/Accessor.cs | 30 -------------- .../TypeMembers/ConstructorDeclaration.cs | 36 ----------------- .../Syntax/TypeMembers/VariableInitializer.cs | 33 ---------------- .../CSharp/Syntax/VariableDesignation.cs | 34 ---------------- 17 files changed, 1 insertion(+), 579 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs index 3707b0c4b..75a1d5e94 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs @@ -43,45 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax // the Root role must be available when creating the null nodes, so we can't put it in the Roles class internal static readonly Role RootRole = new Role("Root", null); - #region Null - public static readonly AstNode Null = new NullAstNode(); - - sealed class NullAstNode : AstNode - { - public override NodeType NodeType { - get { - return NodeType.Unknown; - } - } - - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator AstNode?(PatternMatching.Pattern? pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs index 7734bc98d..7447c8710 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs @@ -31,44 +31,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public abstract partial class AstType : AstNode { - #region Null - public new static readonly AstType Null = new NullAstType(); - - sealed class NullAstType : AstType - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - - public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider) - { - return SpecialType.UnknownType; - } - } - #endregion - #region PatternPlaceholder public static implicit operator AstType(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs index e12b2ce4c..19f5ef080 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs @@ -37,40 +37,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class CSharpTokenNode : AstNode { - public static new readonly CSharpTokenNode Null = new NullCSharpTokenNode(); - class NullCSharpTokenNode : CSharpTokenNode - { - public override bool IsNull { - get { - return true; - } - } - - public NullCSharpTokenNode() : base(TextLocation.Empty, null) - { - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - public override NodeType NodeType { get { return NodeType.Token; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index 0765cbabd..0bf14651c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -60,39 +60,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.Elements.AddRange(elements); } - #region Null - public new static readonly ArrayInitializerExpression Null = new NullArrayInitializerExpression(); - - sealed class NullArrayInitializerExpression : ArrayInitializerExpression - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - public CSharpTokenNode LBraceToken { get { return GetChildByRole(Roles.LBrace); } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs index d48092512..f8f3cf139 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs @@ -17,7 +17,6 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.Collections.Generic; namespace ICSharpCode.Decompiler.CSharp.Syntax { @@ -31,39 +30,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public abstract partial class Expression : AstNode { - #region Null - public new static readonly Expression Null = new NullExpression(); - - sealed class NullExpression : Expression - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator Expression(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs index 96f3c987b..621faccb7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; @@ -51,39 +49,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public abstract partial class InterpolatedStringContent : AstNode { - #region Null - public new static readonly InterpolatedStringContent Null = new NullInterpolatedStringContent(); - - sealed class NullInterpolatedStringContent : InterpolatedStringContent - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - public new static readonly Role Role = new Role("InterpolatedStringContent", Syntax.InterpolatedStringContent.Null); public override NodeType NodeType => NodeType.Unknown; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs index 1c9ba8f5a..e3708a69f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -23,39 +23,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { public static readonly Role ClauseRole = new Role("Clause", null); - #region Null - public new static readonly QueryExpression Null = new NullQueryExpression(); - - sealed class NullQueryExpression : QueryExpression - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - public AstNodeCollection Clauses { get { return GetChildrenByRole(ClauseRole); } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs index e4f1cc784..887a1ca42 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -31,36 +31,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class Identifier : AstNode { - public new static readonly Identifier Null = new NullIdentifier(); - sealed class NullIdentifier : Identifier - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - public override NodeType NodeType { get { return NodeType.Token; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs index 0f655465f..6b8ac0c0b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -35,44 +35,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class SimpleType : AstType { - #region Null - public new static readonly SimpleType Null = new NullSimpleType(); - - sealed class NullSimpleType : SimpleType - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - - public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider) - { - return SpecialType.UnknownType; - } - } - #endregion - public SimpleType() { } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index 5ec485397..98b8cfbc3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -36,38 +36,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { public static readonly Role StatementRole = new Role("Statement", Statement.Null); - #region Null - public static readonly new BlockStatement Null = new NullBlockStatement(); - sealed class NullBlockStatement : BlockStatement - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator BlockStatement(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs index 17910c1e8..8bc13c65f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs @@ -30,39 +30,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public abstract partial class Statement : AstNode { - #region Null - public new static readonly Statement Null = new NullStatement(); - - sealed class NullStatement : Statement - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator Statement(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index 2d985057f..534d2de11 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -95,39 +95,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public static readonly TokenRole CondLPar = new TokenRole("("); public static readonly TokenRole CondRPar = new TokenRole(")"); - #region Null - public new static readonly CatchClause Null = new NullCatchClause(); - - sealed class NullCatchClause : CatchClause - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator CatchClause(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs index 2221d2ecf..73fcb8e8d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -66,39 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class TupleTypeElement : AstNode { - #region Null - public new static readonly TupleTypeElement Null = new TupleTypeElement(); - - sealed class NullTupleTypeElement : TupleTypeElement - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - public AstType Type { get { return GetChildByRole(Roles.Type); } set { SetChildByRole(Roles.Type, value); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs index 12eeb08af..2d76d17a2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs @@ -34,36 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class Accessor : EntityDeclaration { - public static readonly new Accessor Null = new NullAccessor(); - sealed class NullAccessor : Accessor - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - public override NodeType NodeType { get { return NodeType.Unknown; } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index a95a66cbb..7456972cb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -99,42 +99,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public static readonly TokenRole BaseKeywordRole = new TokenRole("base"); public static readonly TokenRole ThisKeywordRole = new TokenRole("this"); - public static readonly new ConstructorInitializer Null = new NullConstructorInitializer(); - class NullConstructorInitializer : ConstructorInitializer - { - public override NodeType NodeType { - get { - return NodeType.Unknown; - } - } - - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - public override NodeType NodeType { get { return NodeType.Unknown; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index 2b547c1de..626c4c03d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -30,39 +30,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(true)] public partial class VariableInitializer : AstNode { - #region Null - public new static readonly VariableInitializer Null = new NullVariableInitializer(); - - sealed class NullVariableInitializer : VariableInitializer - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - #region PatternPlaceholder public static implicit operator VariableInitializer(PatternMatching.Pattern pattern) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs index 9cef6f308..2292a6094 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -24,40 +24,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public abstract partial class VariableDesignation : AstNode { public override NodeType NodeType => NodeType.Unknown; - - #region Null - public new static readonly VariableDesignation Null = new NullVariableDesignation(); - - sealed class NullVariableDesignation : VariableDesignation - { - public override bool IsNull { - get { - return true; - } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullNode(this, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return other == null || other.IsNull; - } - } - #endregion - } /// From bd396adcdd0988e58a084111ca9d22c088542b0a Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 23:01:23 +0200 Subject: [PATCH 06/15] fixup attributes --- .../CSharp/Syntax/AstNode.cs | 2 +- .../CSharp/Syntax/AstType.cs | 2 +- .../CSharp/Syntax/CSharpModifierToken.cs | 2 +- .../CSharp/Syntax/CSharpTokenNode.cs | 2 +- .../CSharp/Syntax/ComposedType.cs | 4 ++-- .../CSharp/Syntax/DocumentationReference.cs | 2 +- .../Expressions/AnonymousMethodExpression.cs | 2 +- .../AnonymousTypeCreateExpression.cs | 2 +- .../Expressions/ArrayCreateExpression.cs | 2 +- .../Expressions/ArrayInitializerExpression.cs | 2 +- .../CSharp/Syntax/Expressions/AsExpression.cs | 2 +- .../Expressions/AssignmentExpression.cs | 2 +- .../Expressions/BaseReferenceExpression.cs | 2 +- .../Expressions/BinaryOperatorExpression.cs | 2 +- .../Syntax/Expressions/CastExpression.cs | 2 +- .../Syntax/Expressions/CheckedExpression.cs | 2 +- .../Expressions/ConditionalExpression.cs | 2 +- .../Expressions/DeclarationExpression.cs | 2 +- .../Expressions/DefaultValueExpression.cs | 2 +- .../Syntax/Expressions/DirectionExpression.cs | 2 +- .../Syntax/Expressions/ErrorExpression.cs | 2 +- .../CSharp/Syntax/Expressions/Expression.cs | 2 +- .../Expressions/IdentifierExpression.cs | 2 +- .../Syntax/Expressions/IndexerExpression.cs | 2 +- .../InterpolatedStringExpression.cs | 8 ++++---- .../Expressions/InvocationExpression.cs | 2 +- .../CSharp/Syntax/Expressions/IsExpression.cs | 2 +- .../Syntax/Expressions/LambdaExpression.cs | 2 +- .../Expressions/MemberReferenceExpression.cs | 2 +- .../Expressions/NamedArgumentExpression.cs | 2 +- .../Syntax/Expressions/NamedExpression.cs | 2 +- .../Expressions/NullReferenceExpression.cs | 2 +- .../Expressions/ObjectCreateExpression.cs | 2 +- .../OutVarDeclarationExpression.cs | 2 +- .../Expressions/ParenthesizedExpression.cs | 2 +- .../Expressions/PointerReferenceExpression.cs | 2 +- .../Syntax/Expressions/PrimitiveExpression.cs | 2 +- .../Syntax/Expressions/QueryExpression.cs | 20 +++++++++---------- .../Expressions/RecursivePatternExpression.cs | 2 +- .../Syntax/Expressions/SizeOfExpression.cs | 2 +- .../Expressions/StackAllocExpression.cs | 2 +- .../Syntax/Expressions/SwitchExpression.cs | 4 ++-- .../Expressions/ThisReferenceExpression.cs | 2 +- .../Syntax/Expressions/ThrowExpression.cs | 2 +- .../Syntax/Expressions/TupleExpression.cs | 2 +- .../Syntax/Expressions/TypeOfExpression.cs | 2 +- .../Expressions/TypeReferenceExpression.cs | 2 +- .../Expressions/UnaryOperatorExpression.cs | 2 +- .../Syntax/Expressions/UncheckedExpression.cs | 2 +- .../Expressions/UndocumentedExpression.cs | 2 +- .../Expressions/WithInitializerExpression.cs | 2 +- .../CSharp/Syntax/FunctionPointerAstType.cs | 2 +- .../CSharp/Syntax/GeneralScope/Attribute.cs | 2 +- .../Syntax/GeneralScope/AttributeSection.cs | 2 +- .../CSharp/Syntax/GeneralScope/Comment.cs | 2 +- .../CSharp/Syntax/GeneralScope/Constraint.cs | 2 +- .../GeneralScope/DelegateDeclaration.cs | 2 +- .../GeneralScope/ExternAliasDeclaration.cs | 2 +- .../GeneralScope/NamespaceDeclaration.cs | 2 +- .../GeneralScope/PreProcessorDirective.cs | 6 +++--- .../Syntax/GeneralScope/TypeDeclaration.cs | 2 +- .../GeneralScope/TypeParameterDeclaration.cs | 2 +- .../GeneralScope/UsingAliasDeclaration.cs | 2 +- .../Syntax/GeneralScope/UsingDeclaration.cs | 2 +- .../CSharp/Syntax/Identifier.cs | 2 +- .../CSharp/Syntax/InvocationAstType.cs | 2 +- .../CSharp/Syntax/MemberType.cs | 2 +- .../CSharp/Syntax/PrimitiveType.cs | 2 +- .../CSharp/Syntax/SimpleType.cs | 2 +- .../Syntax/Statements/BlockStatement.cs | 2 +- .../Syntax/Statements/BreakStatement.cs | 2 +- .../Syntax/Statements/CheckedStatement.cs | 2 +- .../Syntax/Statements/ContinueStatement.cs | 2 +- .../Syntax/Statements/DoWhileStatement.cs | 2 +- .../Syntax/Statements/EmptyStatement.cs | 2 +- .../Syntax/Statements/ExpressionStatement.cs | 2 +- .../Syntax/Statements/FixedStatement.cs | 2 +- .../CSharp/Syntax/Statements/ForStatement.cs | 2 +- .../Syntax/Statements/ForeachStatement.cs | 2 +- .../CSharp/Syntax/Statements/GotoStatement.cs | 6 +++--- .../Syntax/Statements/IfElseStatement.cs | 2 +- .../Syntax/Statements/LabelStatement.cs | 2 +- .../LocalFunctionDeclarationStatement.cs | 2 +- .../CSharp/Syntax/Statements/LockStatement.cs | 2 +- .../Syntax/Statements/ReturnStatement.cs | 2 +- .../CSharp/Syntax/Statements/Statement.cs | 2 +- .../Syntax/Statements/SwitchStatement.cs | 6 +++--- .../Syntax/Statements/ThrowStatement.cs | 2 +- .../Syntax/Statements/TryCatchStatement.cs | 4 ++-- .../Syntax/Statements/UncheckedStatement.cs | 2 +- .../Syntax/Statements/UnsafeStatement.cs | 2 +- .../Syntax/Statements/UsingStatement.cs | 2 +- .../VariableDeclarationStatement.cs | 2 +- .../Syntax/Statements/WhileStatement.cs | 2 +- .../Syntax/Statements/YieldBreakStatement.cs | 2 +- .../Syntax/Statements/YieldReturnStatement.cs | 2 +- .../CSharp/Syntax/SyntaxTree.cs | 2 +- .../CSharp/Syntax/TupleAstType.cs | 4 ++-- .../CSharp/Syntax/TypeMembers/Accessor.cs | 2 +- .../TypeMembers/ConstructorDeclaration.cs | 4 ++-- .../TypeMembers/DestructorDeclaration.cs | 2 +- .../TypeMembers/EnumMemberDeclaration.cs | 2 +- .../Syntax/TypeMembers/EventDeclaration.cs | 4 ++-- .../Syntax/TypeMembers/FieldDeclaration.cs | 2 +- .../TypeMembers/FixedFieldDeclaration.cs | 2 +- .../TypeMembers/FixedVariableInitializer.cs | 2 +- .../Syntax/TypeMembers/IndexerDeclaration.cs | 2 +- .../Syntax/TypeMembers/MethodDeclaration.cs | 2 +- .../Syntax/TypeMembers/OperatorDeclaration.cs | 2 +- .../TypeMembers/ParameterDeclaration.cs | 2 +- .../Syntax/TypeMembers/PropertyDeclaration.cs | 2 +- .../Syntax/TypeMembers/VariableInitializer.cs | 2 +- .../CSharp/Syntax/VariableDesignation.cs | 6 +++--- 113 files changed, 139 insertions(+), 139 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs index 75a1d5e94..0f5666c8e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs @@ -37,7 +37,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class AstNode : AbstractAnnotatable, IFreezable, INode, ICloneable { // the Root role must be available when creating the null nodes, so we can't put it in the Roles class diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs index 7447c8710..9766e0d77 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// A type reference in the C# AST. /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class AstType : AstNode { #region PatternPlaceholder diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs index 6ca9ce12d..d295a515b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpModifierToken.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CSharpModifierToken : CSharpTokenNode { Modifiers modifier; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs index 19f5ef080..00107dde9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs @@ -34,7 +34,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// In all non null c# token nodes the Role of a CSharpToken must be a TokenRole. /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class CSharpTokenNode : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs index 70650fbc7..335ed8982 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs @@ -34,7 +34,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ComposedType : AstType { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; @@ -231,7 +231,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [,,,] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ArraySpecifier : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs index 44af88489..f677ccb62 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a 'cref' reference in XML documentation. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DocumentationReference : AstNode { public static readonly Role DeclaringTypeRole = new Role("DeclaringType", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs index 30c52c986..96a20ab85 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [async] delegate(Parameters) {Body} /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class AnonymousMethodExpression : Expression { public readonly static TokenRole DelegateKeywordRole = new TokenRole("delegate"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs index c2793c3f8..f154fe88c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new { [ExpressionList] } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class AnonymousTypeCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs index 84d583916..dbc2f7910 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new Type[Dimensions] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ArrayCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index 0bf14651c..c56d3c4f5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Elements } /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class ArrayInitializerExpression : Expression { /// diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs index 06c64f84c..522691d7c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression as TypeReference /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class AsExpression : Expression { public readonly static TokenRole AsKeywordRole = new TokenRole("as"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs index af6ac366a..5f14cc6e2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -33,7 +33,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Left Operator= Right /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class AssignmentExpression : Expression { // reuse roles from BinaryOperatorExpression diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs index 48bab380f..6c785e64b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// base /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class BaseReferenceExpression : Expression { public TextLocation Location { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs index 09e414199..6f08b6e28 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Left Operator Right /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class BinaryOperatorExpression : Expression { public readonly static TokenRole BitwiseAndRole = new TokenRole("&"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs index 670154e06..729f703a0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// (CastTo)Expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CastExpression : Expression { public CSharpTokenNode LParToken { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs index 098f1d44f..d13774e51 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs @@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// checked(Expression) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CheckedExpression : Expression { public readonly static TokenRole CheckedKeywordRole = new TokenRole("checked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs index 33ff6906f..5a0fe3edc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Condition ? TrueExpression : FalseExpression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ConditionalExpression : Expression { public readonly static Role ConditionRole = Roles.Condition; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs index 5254405fb..b657c9a59 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// TypeName VariableDesignation /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DeclarationExpression : Expression { public AstType Type { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs index b11368059..da7376f1a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// default(Type) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DefaultValueExpression : Expression { public readonly static TokenRole DefaultKeywordRole = new TokenRole("default"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs index f675384ac..faac5001d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs @@ -38,7 +38,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ref Expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DirectionExpression : Expression { public readonly static TokenRole RefKeywordRole = new TokenRole("ref"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs index 4314e12db..3536fd897 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -25,7 +25,7 @@ // THE SOFTWARE. namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ErrorExpression : Expression { public TextLocation Location { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs index f8f3cf139..54c5bfb5e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be an expression" /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class Expression : AstNode { #region PatternPlaceholder diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs index 45d7a2694..ba3bbdf0e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class IdentifierExpression : Expression { public IdentifierExpression() diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs index 5d083c0b7..4952df1b7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target[Arguments] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class IndexerExpression : Expression { public Expression Target { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs index 621faccb7..bc82afb08 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -4,7 +4,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringExpression : Expression { public static readonly TokenRole OpenQuote = new TokenRole("$\""); @@ -46,7 +46,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class InterpolatedStringContent : AstNode { public new static readonly Role Role = new Role("InterpolatedStringContent", Syntax.InterpolatedStringContent.Null); @@ -57,7 +57,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Expression , Alignment : Suffix } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class Interpolation : InterpolatedStringContent { public static readonly TokenRole LBrace = new TokenRole("{"); @@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class InterpolatedStringText : InterpolatedStringContent { public string Text { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs index 3e5804fe6..dd7a299c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target(Arguments) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class InvocationExpression : Expression { public Expression Target { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs index 158e709fc..089e4ebd2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression is Type /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class IsExpression : Expression { public readonly static TokenRole IsKeywordRole = new TokenRole("is"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs index ca5e8724a..9874fd622 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs @@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [async] Parameters => Body /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class LambdaExpression : Expression { public static readonly Role AttributeRole = new Role("Attribute", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs index a816a4322..4c6251aa2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target.MemberName /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class MemberReferenceExpression : Expression { public Expression Target { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs index c1121f03a..b1fc18231 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents a named argument passed to a method or attribute. /// name: expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class NamedArgumentExpression : Expression { public NamedArgumentExpression() diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs index 64438c19a..bdf5cb68d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This isn't the same as 'assign' even though it has the same syntax. /// This expression is used in object initializers and for named attribute arguments [Attr(FieldName = value)]. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class NamedExpression : Expression { public NamedExpression() diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs index c2f2bbaa1..14c4e1483 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// null /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class NullReferenceExpression : Expression { TextLocation location; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs index 4729341f0..da2f559ae 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new Type(Arguments) { Initializer } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ObjectCreateExpression : Expression { public readonly static TokenRole NewKeywordRole = new TokenRole("new"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs index 70cc5f21b..d00d9bce1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs @@ -21,7 +21,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// out type expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class OutVarDeclarationExpression : Expression { public readonly static TokenRole OutKeywordRole = DirectionExpression.OutKeywordRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs index f08490a0a..394b43b90 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ( Expression ) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ParenthesizedExpression : Expression { public CSharpTokenNode LParToken { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs index 1aa8f5592..635d975b9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Target->MemberName /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PointerReferenceExpression : Expression { public readonly static TokenRole ArrowRole = new TokenRole("->"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs index ddf82ffc0..f53f0525f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs @@ -46,7 +46,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a literal value. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PrimitiveExpression : Expression { public static readonly object AnyValue = new object(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs index e3708a69f..c0d5f6636 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -18,7 +18,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class QueryExpression : Expression { public static readonly Role ClauseRole = new Role("Clause", null); @@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// new QuerySelectClause(e) /// } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryContinuationClause : QueryClause { public static readonly Role PrecedingQueryRole = new Role("PrecedingQuery", QueryExpression.Null); @@ -124,7 +124,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryFromClause : QueryClause { public static readonly TokenRole FromKeywordRole = new TokenRole("from"); @@ -184,7 +184,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryLetClause : QueryClause { public readonly static TokenRole LetKeywordRole = new TokenRole("let"); @@ -238,7 +238,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryWhereClause : QueryClause { public readonly static TokenRole WhereKeywordRole = new TokenRole("where"); @@ -277,7 +277,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents a join or group join clause. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryJoinClause : QueryClause { public static readonly TokenRole JoinKeywordRole = new TokenRole("join"); @@ -388,7 +388,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrderClause : QueryClause { public static readonly TokenRole OrderbyKeywordRole = new TokenRole("orderby"); @@ -424,7 +424,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryOrdering : AstNode { public readonly static TokenRole AscendingKeywordRole = new TokenRole("ascending"); @@ -477,7 +477,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Descending } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QuerySelectClause : QueryClause { public readonly static TokenRole SelectKeywordRole = new TokenRole("select"); @@ -513,7 +513,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class QueryGroupClause : QueryClause { public static readonly TokenRole GroupKeywordRole = new TokenRole("group"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs index f0f7a1d25..85aa497ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs @@ -20,7 +20,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class RecursivePatternExpression : Expression { public static readonly Role SubPatternRole = new Role("SubPattern", Syntax.Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs index 6a3acb9c7..cb5df44f1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// sizeof(Type) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SizeOfExpression : Expression { public readonly static TokenRole SizeofKeywordRole = new TokenRole("sizeof"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs index 0ea2cdf13..67e87d087 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// stackalloc Type[Count] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class StackAllocExpression : Expression { public readonly static TokenRole StackallocKeywordRole = new TokenRole("stackalloc"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs index c1af952a0..1565ba8ed 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression switch { SwitchSections } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SwitchExpression : Expression { public static readonly TokenRole SwitchKeywordRole = new TokenRole("switch"); @@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Pattern => Expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SwitchExpressionSection : AstNode { public static readonly Role PatternRole = new Role("Pattern", Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs index 4eb91600e..e105d6008 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// this /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ThisReferenceExpression : Expression { public TextLocation Location { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs index 4a3db6ac0..9810e6466 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs @@ -21,7 +21,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// throw Expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ThrowExpression : Expression { public static readonly TokenRole ThrowKeywordRole = ThrowStatement.ThrowKeywordRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs index 4840266c0..c9d21a0b2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs @@ -20,7 +20,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TupleExpression : Expression { public AstNodeCollection Elements { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs index 02ec435ef..230691a83 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// typeof(Type) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TypeOfExpression : Expression { public readonly static TokenRole TypeofKeywordRole = new TokenRole("typeof"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs index 5395e3665..12bb73297 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Represents an AstType as an expression. /// This is used when calling a method on a primitive type: "int.Parse()" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TypeReferenceExpression : Expression { public AstType Type { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs index 71ce2714a..ae06ee368 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Operator Expression /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UnaryOperatorExpression : Expression { public readonly static TokenRole NotRole = new TokenRole("!"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs index 1ff20d9a0..5261ad54e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unchecked(Expression) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UncheckedExpression : Expression { public readonly static TokenRole UncheckedKeywordRole = new TokenRole("unchecked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs index 31d6c1528..1f127e816 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs @@ -39,7 +39,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Represents undocumented expressions. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UndocumentedExpression : Expression { public readonly static TokenRole ArglistKeywordRole = new TokenRole("__arglist"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs index b616f3f06..3a7fd75ea 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs @@ -23,7 +23,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression with Initializer /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class WithInitializerExpression : Expression { public readonly static TokenRole WithKeywordRole = new TokenRole("with"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs index 71dca2f48..b75a39807 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class FunctionPointerAstType : AstType { public static readonly TokenRole PointerRole = new TokenRole("*"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs index c7b4e7617..6a7e780c0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Attribute(Arguments) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class Attribute : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs index 26113d93c..be9928e4f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [AttributeTarget: Attributes] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class AttributeSection : AstNode { #region PatternPlaceholder diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs index d9d00f958..d14628202 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs @@ -51,7 +51,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax MultiLineDocumentation } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class Comment : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs index 9111b74a1..1f88c072e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs @@ -33,7 +33,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// new(), struct and class constraints are represented using a PrimitiveType "new", "struct" or "class" /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class Constraint : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs index 975e461e3..0ddf262c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// delegate ReturnType Name<TypeParameters>(Parameters) where Constraints; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DelegateDeclaration : EntityDeclaration { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs index a1031ce48..8c21fc39e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// extern alias IDENTIFIER; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ExternAliasDeclaration : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs index 5446cadc7..34b1590c0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// namespace Name { Members } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class NamespaceDeclaration : AstNode { public static readonly Role MemberRole = SyntaxTree.MemberRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs index 05170720f..81a850fed 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs @@ -46,7 +46,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Line = 12 } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class LinePreprocessorDirective : PreProcessorDirective { public int LineNumber { @@ -68,7 +68,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PragmaWarningPreprocessorDirective : PreProcessorDirective { public static readonly Role WarningRole = new Role("Warning", null); @@ -127,7 +127,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PreProcessorDirective : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs index 6d2e99d5c..7c90d7294 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs @@ -47,7 +47,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// class Name<TypeParameters> : BaseTypes where Constraints; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TypeDeclaration : EntityDeclaration { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs index 8c5305c48..4f65c7d55 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// Note: mirroring the C# syntax, constraints are not part of the type parameter declaration, but belong /// to the parent type or method. /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TypeParameterDeclaration : AstNode { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs index 9f1668526..12a69b56a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// using Alias = Import; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UsingAliasDeclaration : AstNode { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs index bd978ca3d..f0cbacf54 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs @@ -32,7 +32,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// using Import; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UsingDeclaration : AstNode { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs index 887a1ca42..8d884f470 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -28,7 +28,7 @@ using System; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class Identifier : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs index 7c19e40f8..c83d314c6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// BaseType "(" Argument { "," Argument } ")" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class InvocationAstType : AstType { public AstNodeCollection Arguments { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs index a72d94e6b..bcb46d976 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs @@ -32,7 +32,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class MemberType : AstType { public static readonly Role TargetRole = new Role("Target", AstType.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs index 2e1e54cf0..fa600eee6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs @@ -33,7 +33,7 @@ using ICSharpCode.Decompiler.TypeSystem.Implementation; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PrimitiveType : AstType { TextLocation location; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs index 6b8ac0c0b..b86342ddd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -32,7 +32,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class SimpleType : AstType { public SimpleType() diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index 98b8cfbc3..032bcb7e5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Statements } /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class BlockStatement : Statement, IEnumerable { public static readonly Role StatementRole = new Role("Statement", Statement.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs index 89f96a886..8bb7127e5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// break; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class BreakStatement : Statement { public static readonly TokenRole BreakKeywordRole = new TokenRole("break"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs index e70642fc3..286301d90 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// checked BodyBlock /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CheckedStatement : Statement { public static readonly TokenRole CheckedKeywordRole = new TokenRole("checked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs index 9d955f833..8d2011abf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// continue; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ContinueStatement : Statement { public static readonly TokenRole ContinueKeywordRole = new TokenRole("continue"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs index ab90c2022..59a6e43aa 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "do EmbeddedStatement while(Condition);" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DoWhileStatement : Statement { public static readonly TokenRole DoKeywordRole = new TokenRole("do"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs index c1f5e0e18..41168a8e0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class EmptyStatement : Statement { public TextLocation Location { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs index f62adb0b4..f5149d576 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Expression; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ExpressionStatement : Statement { public Expression Expression { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs index 6f0b7f0d3..76abd6c0c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// fixed (Type Variables) EmbeddedStatement /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class FixedStatement : Statement { public static readonly TokenRole FixedKeywordRole = new TokenRole("fixed"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs index 564099a28..030a59dc8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// for (Initializers; Condition; Iterators) EmbeddedStatement /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ForStatement : Statement { public static readonly TokenRole ForKeywordRole = new TokenRole("for"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs index 52bf294fe..4abb0a936 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// foreach (Type VariableName in InExpression) EmbeddedStatement /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ForeachStatement : Statement { public static readonly TokenRole AwaitRole = UnaryOperatorExpression.AwaitRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs index 4a8edede1..0f9b373f1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "goto Label;" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class GotoStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); @@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// or "goto case LabelExpression;" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class GotoCaseStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); @@ -140,7 +140,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// or "goto default;" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class GotoDefaultStatement : Statement { public static readonly TokenRole GotoKeywordRole = new TokenRole("goto"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs index 983edb058..dd85ad91d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// if (Condition) TrueStatement else FalseStatement /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class IfElseStatement : Statement { public readonly static TokenRole IfKeywordRole = new TokenRole("if"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs index fe95941c3..d9b34f059 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Label: /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class LabelStatement : Statement { public string Label { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs index e98b7afd1..20b8939fc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs @@ -20,7 +20,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class LocalFunctionDeclarationStatement : Statement { public static readonly Role MethodDeclarationRole = new Role("Method", null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs index fc3ccc4a8..d6defd83f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// lock (Expression) EmbeddedStatement; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class LockStatement : Statement { public static readonly TokenRole LockKeywordRole = new TokenRole("lock"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs index d16609501..a68c96b32 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// return Expression; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ReturnStatement : Statement { public static readonly TokenRole ReturnKeywordRole = new TokenRole("return"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs index 8bc13c65f..7767a5590 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be a statement" /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class Statement : AstNode { #region PatternPlaceholder diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs index ce0a1b358..cc40c653d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// switch (Expression) { SwitchSections } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SwitchStatement : Statement { public static readonly TokenRole SwitchKeywordRole = new TokenRole("switch"); @@ -87,7 +87,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SwitchSection : AstNode { #region PatternPlaceholder @@ -174,7 +174,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CaseLabel : AstNode { public static readonly TokenRole CaseKeywordRole = new TokenRole("case"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs index 9f6b9b846..e5f19aef9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// throw Expression; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ThrowStatement : Statement { public static readonly TokenRole ThrowKeywordRole = new TokenRole("throw"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index 534d2de11..b6ae5db04 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// try TryBlock CatchClauses finally FinallyBlock /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TryCatchStatement : Statement { public static readonly TokenRole TryKeywordRole = new TokenRole("try"); @@ -86,7 +86,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// catch (Type VariableName) { Body } /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class CatchClause : AstNode { public static readonly TokenRole CatchKeywordRole = new TokenRole("catch"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs index a74cf056b..5f5197bbf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unchecked BodyBlock /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UncheckedStatement : Statement { public static readonly TokenRole UncheckedKeywordRole = new TokenRole("unchecked"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs index db4dc067a..d0b5a7a72 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// unsafe { Body } /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UnsafeStatement : Statement { public static readonly TokenRole UnsafeKeywordRole = new TokenRole("unsafe"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs index 45c0d5369..d900c3a22 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [ await ] using (ResourceAcquisition) EmbeddedStatement /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class UsingStatement : Statement { public static readonly TokenRole UsingKeywordRole = new TokenRole("using"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs index 8d4daa5b0..b9ed5d164 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class VariableDeclarationStatement : Statement { public static readonly Role ModifierRole = EntityDeclaration.ModifierRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs index 33d01c4a9..8bdcd5f25 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// "while (Condition) EmbeddedStatement" /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class WhileStatement : Statement { public static readonly TokenRole WhileKeywordRole = new TokenRole("while"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs index 96cec086b..5a45f6d3f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// yield break; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class YieldBreakStatement : Statement { public static readonly TokenRole YieldKeywordRole = new TokenRole("yield"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs index d562f1859..fa25ddbe1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// yield return Expression; /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class YieldReturnStatement : Statement { public static readonly TokenRole YieldKeywordRole = new TokenRole("yield"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs index 1187e8e4e..bde54a30b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs @@ -30,7 +30,7 @@ using ICSharpCode.Decompiler.Util; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SyntaxTree : AstNode { public static readonly Role MemberRole = new Role("Member", AstNode.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs index 73fcb8e8d..fcdaacc64 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -25,7 +25,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class TupleAstType : AstType { public static readonly Role ElementRole = new Role("Element", TupleTypeElement.Null); @@ -63,7 +63,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class TupleTypeElement : AstNode { public AstType Type { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs index 2d76d17a2..d7197858c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// get/set/init/add/remove /// - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class Accessor : EntityDeclaration { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index 7456972cb..883e6cf68 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ConstructorDeclaration : EntityDeclaration { public static readonly Role InitializerRole = new Role("Initializer", ConstructorInitializer.Null); @@ -93,7 +93,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax This } - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class ConstructorInitializer : AstNode { public static readonly TokenRole BaseKeywordRole = new TokenRole("base"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs index d43276938..ac3657e59 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class DestructorDeclaration : EntityDeclaration { public static readonly TokenRole TildeRole = new TokenRole("~"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs index a3726e150..ab6f0e3c1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class EnumMemberDeclaration : EntityDeclaration { public static readonly Role InitializerRole = new Role("Initializer", Expression.Null); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs index 24a752831..0a5bc1b50 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class EventDeclaration : EntityDeclaration { public static readonly TokenRole EventKeywordRole = new TokenRole("event"); @@ -85,7 +85,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class CustomEventDeclaration : EntityDeclaration { public static readonly TokenRole EventKeywordRole = new TokenRole("event"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs index 553b241bf..840743e82 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class FieldDeclaration : EntityDeclaration { public override SymbolKind SymbolKind { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs index 9694d54fa..1ed741e24 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs @@ -27,7 +27,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class FixedFieldDeclaration : EntityDeclaration { public static readonly TokenRole FixedKeywordRole = new TokenRole("fixed"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs index 8fe3fc4b5..08b9938cd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Name [ CountExpression ] /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class FixedVariableInitializer : AstNode { public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs index ead89ba5e..c3ad4ea6c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -31,7 +31,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class IndexerDeclaration : EntityDeclaration { public static readonly TokenRole ThisKeywordRole = new TokenRole("this"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs index 27d213f81..0c3fc1149 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class MethodDeclaration : EntityDeclaration { public override SymbolKind SymbolKind { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs index 7694d05f4..85719e5b7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -76,7 +76,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax CheckedExplicit } - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class OperatorDeclaration : EntityDeclaration { public static readonly TokenRole OperatorKeywordRole = new TokenRole("operator"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs index fe1eb1ade..3394aa94d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -30,7 +30,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ParameterDeclaration : AstNode { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs index f4e5d8ddc..daa35edb0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -28,7 +28,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class PropertyDeclaration : EntityDeclaration { public static readonly TokenRole GetKeywordRole = new TokenRole("get"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index 626c4c03d..efdb31317 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public partial class VariableInitializer : AstNode { #region PatternPlaceholder diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs index 2292a6094..2fa76e8c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -20,7 +20,7 @@ using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(true)] + [DecompilerAstNode(hasNullNode: true)] public abstract partial class VariableDesignation : AstNode { public override NodeType NodeType => NodeType.Unknown; @@ -29,7 +29,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// Identifier /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class SingleVariableDesignation : VariableDesignation { public string Identifier { @@ -66,7 +66,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// ( VariableDesignation (, VariableDesignation)* ) /// - [DecompilerAstNode(false)] + [DecompilerAstNode(hasNullNode: false)] public partial class ParenthesizedVariableDesignation : VariableDesignation { From 19a626240512894c9a656a492283ab2ad38ff831 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 4 May 2025 23:06:19 +0200 Subject: [PATCH 07/15] Generate Visitor Pattern --- .../Expressions/AnonymousMethodExpression.cs | 15 - .../AnonymousTypeCreateExpression.cs | 15 - .../Expressions/ArrayCreateExpression.cs | 16 - .../Expressions/ArrayInitializerExpression.cs | 15 - .../CSharp/Syntax/Expressions/AsExpression.cs | 15 - .../Expressions/AssignmentExpression.cs | 15 - .../Expressions/BaseReferenceExpression.cs | 15 - .../Expressions/BinaryOperatorExpression.cs | 15 - .../CSharp/Syntax/IAstVisitor.cs | 468 ------------------ .../CSharp/Syntax/TypeMembers/Accessor.cs | 15 - .../TypeMembers/ConstructorDeclaration.cs | 15 - .../ICSharpCode.Decompiler.csproj | 1 - 12 files changed, 620 deletions(-) delete mode 100644 ICSharpCode.Decompiler/CSharp/Syntax/IAstVisitor.cs diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs index 96a20ab85..34caf0551 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs @@ -95,21 +95,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAnonymousMethodExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAnonymousMethodExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAnonymousMethodExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { AnonymousMethodExpression o = other as AnonymousMethodExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs index f154fe88c..908ddb6fe 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs @@ -67,21 +67,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAnonymousTypeCreateExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAnonymousTypeCreateExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAnonymousTypeCreateExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as AnonymousTypeCreateExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs index dbc2f7910..aece68c6b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs @@ -54,22 +54,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(InitializerRole); } set { SetChildByRole(InitializerRole, value); } } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitArrayCreateExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitArrayCreateExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitArrayCreateExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ArrayCreateExpression o = other as ArrayCreateExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index c56d3c4f5..9c5458af8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -72,21 +72,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitArrayInitializerExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitArrayInitializerExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitArrayInitializerExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ArrayInitializerExpression o = other as ArrayInitializerExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs index 522691d7c..1ec95755b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -59,21 +59,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(type, Roles.Type); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAsExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAsExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAsExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { AsExpression o = other as AsExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs index 5f14cc6e2..839cafae8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -89,21 +89,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(RightRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAssignmentExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAssignmentExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAssignmentExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { AssignmentExpression o = other as AssignmentExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs index 6c785e64b..82cf0fc0a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs @@ -49,21 +49,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitBaseReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitBaseReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitBaseReferenceExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { BaseReferenceExpression o = other as BaseReferenceExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs index 6f08b6e28..2c98080f1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -91,21 +91,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(RightRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitBinaryOperatorExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitBinaryOperatorExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitBinaryOperatorExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { BinaryOperatorExpression o = other as BinaryOperatorExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/IAstVisitor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/IAstVisitor.cs deleted file mode 100644 index 37dfd40a3..000000000 --- a/ICSharpCode.Decompiler/CSharp/Syntax/IAstVisitor.cs +++ /dev/null @@ -1,468 +0,0 @@ -// Copyright (c) 2010-2013 AlphaSierraPapa for the SharpDevelop Team -// -// Permission is hereby granted, free of charge, to any person obtaining a copy of this -// software and associated documentation files (the "Software"), to deal in the Software -// without restriction, including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons -// to whom the Software is furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all copies or -// substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. - - -namespace ICSharpCode.Decompiler.CSharp.Syntax -{ - /// - /// AST visitor. - /// - public interface IAstVisitor - { - void VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression); - void VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression); - void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression); - void VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression); - void VisitAsExpression(AsExpression asExpression); - void VisitAssignmentExpression(AssignmentExpression assignmentExpression); - void VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression); - void VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression); - void VisitCastExpression(CastExpression castExpression); - void VisitCheckedExpression(CheckedExpression checkedExpression); - void VisitConditionalExpression(ConditionalExpression conditionalExpression); - void VisitDeclarationExpression(DeclarationExpression declarationExpression); - void VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression); - void VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression); - void VisitDirectionExpression(DirectionExpression directionExpression); - void VisitIdentifierExpression(IdentifierExpression identifierExpression); - void VisitIndexerExpression(IndexerExpression indexerExpression); - void VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression); - void VisitInvocationExpression(InvocationExpression invocationExpression); - void VisitIsExpression(IsExpression isExpression); - void VisitLambdaExpression(LambdaExpression lambdaExpression); - void VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression); - void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression); - void VisitNamedExpression(NamedExpression namedExpression); - void VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression); - void VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression); - void VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression); - void VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression); - void VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression); - void VisitPrimitiveExpression(PrimitiveExpression primitiveExpression); - void VisitSizeOfExpression(SizeOfExpression sizeOfExpression); - void VisitStackAllocExpression(StackAllocExpression stackAllocExpression); - void VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression); - void VisitThrowExpression(ThrowExpression throwExpression); - void VisitTupleExpression(TupleExpression tupleExpression); - void VisitTypeOfExpression(TypeOfExpression typeOfExpression); - void VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression); - void VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression); - void VisitUncheckedExpression(UncheckedExpression uncheckedExpression); - void VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression); - void VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression); - - void VisitQueryExpression(QueryExpression queryExpression); - void VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause); - void VisitQueryFromClause(QueryFromClause queryFromClause); - void VisitQueryLetClause(QueryLetClause queryLetClause); - void VisitQueryWhereClause(QueryWhereClause queryWhereClause); - void VisitQueryJoinClause(QueryJoinClause queryJoinClause); - void VisitQueryOrderClause(QueryOrderClause queryOrderClause); - void VisitQueryOrdering(QueryOrdering queryOrdering); - void VisitQuerySelectClause(QuerySelectClause querySelectClause); - void VisitQueryGroupClause(QueryGroupClause queryGroupClause); - - void VisitAttribute(Attribute attribute); - void VisitAttributeSection(AttributeSection attributeSection); - void VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration); - void VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration); - void VisitTypeDeclaration(TypeDeclaration typeDeclaration); - void VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration); - void VisitUsingDeclaration(UsingDeclaration usingDeclaration); - void VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration); - - void VisitBlockStatement(BlockStatement blockStatement); - void VisitBreakStatement(BreakStatement breakStatement); - void VisitCheckedStatement(CheckedStatement checkedStatement); - void VisitContinueStatement(ContinueStatement continueStatement); - void VisitDoWhileStatement(DoWhileStatement doWhileStatement); - void VisitEmptyStatement(EmptyStatement emptyStatement); - void VisitExpressionStatement(ExpressionStatement expressionStatement); - void VisitFixedStatement(FixedStatement fixedStatement); - void VisitForeachStatement(ForeachStatement foreachStatement); - void VisitForStatement(ForStatement forStatement); - void VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement); - void VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement); - void VisitGotoStatement(GotoStatement gotoStatement); - void VisitIfElseStatement(IfElseStatement ifElseStatement); - void VisitLabelStatement(LabelStatement labelStatement); - void VisitLockStatement(LockStatement lockStatement); - void VisitReturnStatement(ReturnStatement returnStatement); - void VisitSwitchStatement(SwitchStatement switchStatement); - void VisitSwitchSection(SwitchSection switchSection); - void VisitCaseLabel(CaseLabel caseLabel); - void VisitSwitchExpression(SwitchExpression switchExpression); - void VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection); - void VisitThrowStatement(ThrowStatement throwStatement); - void VisitTryCatchStatement(TryCatchStatement tryCatchStatement); - void VisitCatchClause(CatchClause catchClause); - void VisitUncheckedStatement(UncheckedStatement uncheckedStatement); - void VisitUnsafeStatement(UnsafeStatement unsafeStatement); - void VisitUsingStatement(UsingStatement usingStatement); - void VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement); - void VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement); - void VisitWhileStatement(WhileStatement whileStatement); - void VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement); - void VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement); - - void VisitAccessor(Accessor accessor); - void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration); - void VisitConstructorInitializer(ConstructorInitializer constructorInitializer); - void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration); - void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration); - void VisitEventDeclaration(EventDeclaration eventDeclaration); - void VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration); - void VisitFieldDeclaration(FieldDeclaration fieldDeclaration); - void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration); - void VisitMethodDeclaration(MethodDeclaration methodDeclaration); - void VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration); - void VisitParameterDeclaration(ParameterDeclaration parameterDeclaration); - void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration); - void VisitVariableInitializer(VariableInitializer variableInitializer); - void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); - void VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); - - void VisitSyntaxTree(SyntaxTree syntaxTree); - void VisitSimpleType(SimpleType simpleType); - void VisitMemberType(MemberType memberType); - void VisitTupleType(TupleAstType tupleType); - void VisitTupleTypeElement(TupleTypeElement tupleTypeElement); - void VisitFunctionPointerType(FunctionPointerAstType functionPointerType); - void VisitInvocationType(InvocationAstType invocationType); - void VisitComposedType(ComposedType composedType); - void VisitArraySpecifier(ArraySpecifier arraySpecifier); - void VisitPrimitiveType(PrimitiveType primitiveType); - - void VisitComment(Comment comment); - void VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective); - void VisitDocumentationReference(DocumentationReference documentationReference); - - void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration); - void VisitConstraint(Constraint constraint); - void VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode); - void VisitIdentifier(Identifier identifier); - - void VisitInterpolation(Interpolation interpolation); - void VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText); - - void VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation); - void VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation); - - void VisitNullNode(AstNode nullNode); - void VisitErrorNode(AstNode errorNode); - void VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern); - } - - /// - /// AST visitor. - /// - public interface IAstVisitor - { - S VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression); - S VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression); - S VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression); - S VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression); - S VisitAsExpression(AsExpression asExpression); - S VisitAssignmentExpression(AssignmentExpression assignmentExpression); - S VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression); - S VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression); - S VisitCastExpression(CastExpression castExpression); - S VisitCheckedExpression(CheckedExpression checkedExpression); - S VisitConditionalExpression(ConditionalExpression conditionalExpression); - S VisitDeclarationExpression(DeclarationExpression declarationExpression); - S VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression); - S VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression); - S VisitDirectionExpression(DirectionExpression directionExpression); - S VisitIdentifierExpression(IdentifierExpression identifierExpression); - S VisitIndexerExpression(IndexerExpression indexerExpression); - S VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression); - S VisitInvocationExpression(InvocationExpression invocationExpression); - S VisitIsExpression(IsExpression isExpression); - S VisitLambdaExpression(LambdaExpression lambdaExpression); - S VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression); - S VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression); - S VisitNamedExpression(NamedExpression namedExpression); - S VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression); - S VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression); - S VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression); - S VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression); - S VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression); - S VisitPrimitiveExpression(PrimitiveExpression primitiveExpression); - S VisitSizeOfExpression(SizeOfExpression sizeOfExpression); - S VisitStackAllocExpression(StackAllocExpression stackAllocExpression); - S VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression); - S VisitThrowExpression(ThrowExpression throwExpression); - S VisitTupleExpression(TupleExpression tupleExpression); - S VisitTypeOfExpression(TypeOfExpression typeOfExpression); - S VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression); - S VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression); - S VisitUncheckedExpression(UncheckedExpression uncheckedExpression); - S VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression); - S VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression); - - S VisitQueryExpression(QueryExpression queryExpression); - S VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause); - S VisitQueryFromClause(QueryFromClause queryFromClause); - S VisitQueryLetClause(QueryLetClause queryLetClause); - S VisitQueryWhereClause(QueryWhereClause queryWhereClause); - S VisitQueryJoinClause(QueryJoinClause queryJoinClause); - S VisitQueryOrderClause(QueryOrderClause queryOrderClause); - S VisitQueryOrdering(QueryOrdering queryOrdering); - S VisitQuerySelectClause(QuerySelectClause querySelectClause); - S VisitQueryGroupClause(QueryGroupClause queryGroupClause); - - S VisitAttribute(Attribute attribute); - S VisitAttributeSection(AttributeSection attributeSection); - S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration); - S VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration); - S VisitTypeDeclaration(TypeDeclaration typeDeclaration); - S VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration); - S VisitUsingDeclaration(UsingDeclaration usingDeclaration); - S VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration); - - S VisitBlockStatement(BlockStatement blockStatement); - S VisitBreakStatement(BreakStatement breakStatement); - S VisitCheckedStatement(CheckedStatement checkedStatement); - S VisitContinueStatement(ContinueStatement continueStatement); - S VisitDoWhileStatement(DoWhileStatement doWhileStatement); - S VisitEmptyStatement(EmptyStatement emptyStatement); - S VisitExpressionStatement(ExpressionStatement expressionStatement); - S VisitFixedStatement(FixedStatement fixedStatement); - S VisitForeachStatement(ForeachStatement foreachStatement); - S VisitForStatement(ForStatement forStatement); - S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement); - S VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement); - S VisitGotoStatement(GotoStatement gotoStatement); - S VisitIfElseStatement(IfElseStatement ifElseStatement); - S VisitLabelStatement(LabelStatement labelStatement); - S VisitLockStatement(LockStatement lockStatement); - S VisitReturnStatement(ReturnStatement returnStatement); - S VisitSwitchStatement(SwitchStatement switchStatement); - S VisitSwitchSection(SwitchSection switchSection); - S VisitCaseLabel(CaseLabel caseLabel); - S VisitSwitchExpression(SwitchExpression switchExpression); - S VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection); - S VisitThrowStatement(ThrowStatement throwStatement); - S VisitTryCatchStatement(TryCatchStatement tryCatchStatement); - S VisitCatchClause(CatchClause catchClause); - S VisitUncheckedStatement(UncheckedStatement uncheckedStatement); - S VisitUnsafeStatement(UnsafeStatement unsafeStatement); - S VisitUsingStatement(UsingStatement usingStatement); - S VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement); - S VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement); - S VisitWhileStatement(WhileStatement whileStatement); - S VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement); - S VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement); - - S VisitAccessor(Accessor accessor); - S VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration); - S VisitConstructorInitializer(ConstructorInitializer constructorInitializer); - S VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration); - S VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration); - S VisitEventDeclaration(EventDeclaration eventDeclaration); - S VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration); - S VisitFieldDeclaration(FieldDeclaration fieldDeclaration); - S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration); - S VisitMethodDeclaration(MethodDeclaration methodDeclaration); - S VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration); - S VisitParameterDeclaration(ParameterDeclaration parameterDeclaration); - S VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration); - S VisitVariableInitializer(VariableInitializer variableInitializer); - S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration); - S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer); - - S VisitSyntaxTree(SyntaxTree syntaxTree); - S VisitSimpleType(SimpleType simpleType); - S VisitMemberType(MemberType memberType); - S VisitTupleType(TupleAstType tupleType); - S VisitTupleTypeElement(TupleTypeElement tupleTypeElement); - S VisitFunctionPointerType(FunctionPointerAstType functionPointerType); - S VisitInvocationType(InvocationAstType invocationType); - S VisitComposedType(ComposedType composedType); - S VisitArraySpecifier(ArraySpecifier arraySpecifier); - S VisitPrimitiveType(PrimitiveType primitiveType); - - S VisitComment(Comment comment); - S VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective); - S VisitDocumentationReference(DocumentationReference documentationReference); - - S VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration); - S VisitConstraint(Constraint constraint); - S VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode); - S VisitIdentifier(Identifier identifier); - - S VisitInterpolation(Interpolation interpolation); - S VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText); - - S VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation); - S VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation); - - S VisitNullNode(AstNode nullNode); - S VisitErrorNode(AstNode errorNode); - S VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern); - } - - /// - /// AST visitor. - /// - public interface IAstVisitor - { - S VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, T data); - S VisitAnonymousTypeCreateExpression(AnonymousTypeCreateExpression anonymousTypeCreateExpression, T data); - S VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, T data); - S VisitArrayInitializerExpression(ArrayInitializerExpression arrayInitializerExpression, T data); - S VisitAsExpression(AsExpression asExpression, T data); - S VisitAssignmentExpression(AssignmentExpression assignmentExpression, T data); - S VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, T data); - S VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, T data); - S VisitCastExpression(CastExpression castExpression, T data); - S VisitCheckedExpression(CheckedExpression checkedExpression, T data); - S VisitConditionalExpression(ConditionalExpression conditionalExpression, T data); - S VisitDeclarationExpression(DeclarationExpression declarationExpression, T data); - S VisitRecursivePatternExpression(RecursivePatternExpression recursivePatternExpression, T data); - S VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, T data); - S VisitDirectionExpression(DirectionExpression directionExpression, T data); - S VisitIdentifierExpression(IdentifierExpression identifierExpression, T data); - S VisitIndexerExpression(IndexerExpression indexerExpression, T data); - S VisitInterpolatedStringExpression(InterpolatedStringExpression interpolatedStringExpression, T data); - S VisitInvocationExpression(InvocationExpression invocationExpression, T data); - S VisitIsExpression(IsExpression isExpression, T data); - S VisitLambdaExpression(LambdaExpression lambdaExpression, T data); - S VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, T data); - S VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, T data); - S VisitNamedExpression(NamedExpression namedExpression, T data); - S VisitNullReferenceExpression(NullReferenceExpression nullReferenceExpression, T data); - S VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, T data); - S VisitOutVarDeclarationExpression(OutVarDeclarationExpression outVarDeclarationExpression, T data); - S VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, T data); - S VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, T data); - S VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, T data); - S VisitSizeOfExpression(SizeOfExpression sizeOfExpression, T data); - S VisitStackAllocExpression(StackAllocExpression stackAllocExpression, T data); - S VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, T data); - S VisitThrowExpression(ThrowExpression throwExpression, T data); - S VisitTupleExpression(TupleExpression tupleExpression, T data); - S VisitTypeOfExpression(TypeOfExpression typeOfExpression, T data); - S VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, T data); - S VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, T data); - S VisitUncheckedExpression(UncheckedExpression uncheckedExpression, T data); - S VisitUndocumentedExpression(UndocumentedExpression undocumentedExpression, T data); - S VisitWithInitializerExpression(WithInitializerExpression withInitializerExpression, T data); - - S VisitQueryExpression(QueryExpression queryExpression, T data); - S VisitQueryContinuationClause(QueryContinuationClause queryContinuationClause, T data); - S VisitQueryFromClause(QueryFromClause queryFromClause, T data); - S VisitQueryLetClause(QueryLetClause queryLetClause, T data); - S VisitQueryWhereClause(QueryWhereClause queryWhereClause, T data); - S VisitQueryJoinClause(QueryJoinClause queryJoinClause, T data); - S VisitQueryOrderClause(QueryOrderClause queryOrderClause, T data); - S VisitQueryOrdering(QueryOrdering queryOrdering, T data); - S VisitQuerySelectClause(QuerySelectClause querySelectClause, T data); - S VisitQueryGroupClause(QueryGroupClause queryGroupClause, T data); - - S VisitAttribute(Attribute attribute, T data); - S VisitAttributeSection(AttributeSection attributeSection, T data); - S VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, T data); - S VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, T data); - S VisitTypeDeclaration(TypeDeclaration typeDeclaration, T data); - S VisitUsingAliasDeclaration(UsingAliasDeclaration usingAliasDeclaration, T data); - S VisitUsingDeclaration(UsingDeclaration usingDeclaration, T data); - S VisitExternAliasDeclaration(ExternAliasDeclaration externAliasDeclaration, T data); - - S VisitBlockStatement(BlockStatement blockStatement, T data); - S VisitBreakStatement(BreakStatement breakStatement, T data); - S VisitCheckedStatement(CheckedStatement checkedStatement, T data); - S VisitContinueStatement(ContinueStatement continueStatement, T data); - S VisitDoWhileStatement(DoWhileStatement doWhileStatement, T data); - S VisitEmptyStatement(EmptyStatement emptyStatement, T data); - S VisitExpressionStatement(ExpressionStatement expressionStatement, T data); - S VisitFixedStatement(FixedStatement fixedStatement, T data); - S VisitForeachStatement(ForeachStatement foreachStatement, T data); - S VisitForStatement(ForStatement forStatement, T data); - S VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, T data); - S VisitGotoDefaultStatement(GotoDefaultStatement gotoDefaultStatement, T data); - S VisitGotoStatement(GotoStatement gotoStatement, T data); - S VisitIfElseStatement(IfElseStatement ifElseStatement, T data); - S VisitLabelStatement(LabelStatement labelStatement, T data); - S VisitLockStatement(LockStatement lockStatement, T data); - S VisitReturnStatement(ReturnStatement returnStatement, T data); - S VisitSwitchStatement(SwitchStatement switchStatement, T data); - S VisitSwitchSection(SwitchSection switchSection, T data); - S VisitCaseLabel(CaseLabel caseLabel, T data); - S VisitSwitchExpression(SwitchExpression switchExpression, T data); - S VisitSwitchExpressionSection(SwitchExpressionSection switchExpressionSection, T data); - S VisitThrowStatement(ThrowStatement throwStatement, T data); - S VisitTryCatchStatement(TryCatchStatement tryCatchStatement, T data); - S VisitCatchClause(CatchClause catchClause, T data); - S VisitUncheckedStatement(UncheckedStatement uncheckedStatement, T data); - S VisitUnsafeStatement(UnsafeStatement unsafeStatement, T data); - S VisitUsingStatement(UsingStatement usingStatement, T data); - S VisitVariableDeclarationStatement(VariableDeclarationStatement variableDeclarationStatement, T data); - S VisitLocalFunctionDeclarationStatement(LocalFunctionDeclarationStatement localFunctionDeclarationStatement, T data); - S VisitWhileStatement(WhileStatement whileStatement, T data); - S VisitYieldBreakStatement(YieldBreakStatement yieldBreakStatement, T data); - S VisitYieldReturnStatement(YieldReturnStatement yieldReturnStatement, T data); - - S VisitAccessor(Accessor accessor, T data); - S VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, T data); - S VisitConstructorInitializer(ConstructorInitializer constructorInitializer, T data); - S VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, T data); - S VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration, T data); - S VisitEventDeclaration(EventDeclaration eventDeclaration, T data); - S VisitCustomEventDeclaration(CustomEventDeclaration customEventDeclaration, T data); - S VisitFieldDeclaration(FieldDeclaration fieldDeclaration, T data); - S VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, T data); - S VisitMethodDeclaration(MethodDeclaration methodDeclaration, T data); - S VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, T data); - S VisitParameterDeclaration(ParameterDeclaration parameterDeclaration, T data); - S VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, T data); - S VisitVariableInitializer(VariableInitializer variableInitializer, T data); - S VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration, T data); - S VisitFixedVariableInitializer(FixedVariableInitializer fixedVariableInitializer, T data); - - S VisitSyntaxTree(SyntaxTree syntaxTree, T data); - S VisitSimpleType(SimpleType simpleType, T data); - S VisitMemberType(MemberType memberType, T data); - S VisitTupleType(TupleAstType tupleType, T data); - S VisitTupleTypeElement(TupleTypeElement tupleTypeElement, T data); - S VisitFunctionPointerType(FunctionPointerAstType functionPointerType, T data); - S VisitInvocationType(InvocationAstType invocationType, T data); - S VisitComposedType(ComposedType composedType, T data); - S VisitArraySpecifier(ArraySpecifier arraySpecifier, T data); - S VisitPrimitiveType(PrimitiveType primitiveType, T data); - - S VisitComment(Comment comment, T data); - S VisitPreProcessorDirective(PreProcessorDirective preProcessorDirective, T data); - S VisitDocumentationReference(DocumentationReference documentationReference, T data); - - S VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration, T data); - S VisitConstraint(Constraint constraint, T data); - S VisitCSharpTokenNode(CSharpTokenNode cSharpTokenNode, T data); - S VisitIdentifier(Identifier identifier, T data); - - S VisitInterpolation(Interpolation interpolation, T data); - S VisitInterpolatedStringText(InterpolatedStringText interpolatedStringText, T data); - - S VisitSingleVariableDesignation(SingleVariableDesignation singleVariableDesignation, T data); - S VisitParenthesizedVariableDesignation(ParenthesizedVariableDesignation parenthesizedVariableDesignation, T data); - - S VisitNullNode(AstNode nullNode, T data); - S VisitErrorNode(AstNode errorNode, T data); - S VisitPatternPlaceholder(AstNode placeholder, PatternMatching.Pattern pattern, T data); - } -} diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs index d7197858c..7019beddd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs @@ -65,21 +65,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAccessor(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAccessor(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAccessor(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { Accessor o = other as Accessor; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index 883e6cf68..b1fd821e0 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -63,21 +63,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitConstructorDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitConstructorDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitConstructorDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ConstructorDeclaration o = other as ConstructorDeclaration; diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 3f9a51156..fdaca9d89 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -237,7 +237,6 @@ - From 8a123d2b1bcfc132b3fc0a81d8e49f208b84f318 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 00:25:01 +0200 Subject: [PATCH 08/15] Generate AcceptVisitor overloads --- .../DecompilerSyntaxTreeGenerator.cs | 6 +- .../CSharp/Syntax/CSharpTokenNode.cs | 15 -- .../CSharp/Syntax/ComposedType.cs | 30 ---- .../CSharp/Syntax/DocumentationReference.cs | 15 -- .../Syntax/Expressions/CastExpression.cs | 15 -- .../Syntax/Expressions/CheckedExpression.cs | 15 -- .../Expressions/ConditionalExpression.cs | 15 -- .../Expressions/DeclarationExpression.cs | 15 -- .../Expressions/DefaultValueExpression.cs | 15 -- .../Syntax/Expressions/DirectionExpression.cs | 15 -- .../Syntax/Expressions/ErrorExpression.cs | 15 -- .../Expressions/IdentifierExpression.cs | 15 -- .../Syntax/Expressions/IndexerExpression.cs | 15 -- .../InterpolatedStringExpression.cs | 45 ------ .../Expressions/InvocationExpression.cs | 15 -- .../CSharp/Syntax/Expressions/IsExpression.cs | 16 -- .../Syntax/Expressions/LambdaExpression.cs | 15 -- .../Expressions/MemberReferenceExpression.cs | 15 -- .../Expressions/NamedArgumentExpression.cs | 15 -- .../Syntax/Expressions/NamedExpression.cs | 15 -- .../Expressions/NullReferenceExpression.cs | 15 -- .../Expressions/ObjectCreateExpression.cs | 15 -- .../OutVarDeclarationExpression.cs | 15 -- .../Expressions/ParenthesizedExpression.cs | 15 -- .../Expressions/PointerReferenceExpression.cs | 15 -- .../Syntax/Expressions/PrimitiveExpression.cs | 15 -- .../Syntax/Expressions/QueryExpression.cs | 150 ------------------ .../Expressions/RecursivePatternExpression.cs | 15 -- .../Syntax/Expressions/SizeOfExpression.cs | 15 -- .../Expressions/StackAllocExpression.cs | 15 -- .../Syntax/Expressions/SwitchExpression.cs | 30 ---- .../Expressions/ThisReferenceExpression.cs | 15 -- .../Syntax/Expressions/ThrowExpression.cs | 15 -- .../Syntax/Expressions/TupleExpression.cs | 15 -- .../Syntax/Expressions/TypeOfExpression.cs | 15 -- .../Expressions/TypeReferenceExpression.cs | 15 -- .../Expressions/UnaryOperatorExpression.cs | 15 -- .../Syntax/Expressions/UncheckedExpression.cs | 15 -- .../Expressions/UndocumentedExpression.cs | 15 -- .../Expressions/WithInitializerExpression.cs | 15 -- .../CSharp/Syntax/FunctionPointerAstType.cs | 15 -- .../CSharp/Syntax/GeneralScope/Attribute.cs | 15 -- .../Syntax/GeneralScope/AttributeSection.cs | 15 -- .../CSharp/Syntax/GeneralScope/Comment.cs | 15 -- .../CSharp/Syntax/GeneralScope/Constraint.cs | 15 -- .../GeneralScope/DelegateDeclaration.cs | 15 -- .../GeneralScope/ExternAliasDeclaration.cs | 15 -- .../GeneralScope/NamespaceDeclaration.cs | 15 -- .../GeneralScope/PreProcessorDirective.cs | 15 -- .../Syntax/GeneralScope/TypeDeclaration.cs | 15 -- .../GeneralScope/TypeParameterDeclaration.cs | 15 -- .../GeneralScope/UsingAliasDeclaration.cs | 15 -- .../Syntax/GeneralScope/UsingDeclaration.cs | 15 -- .../CSharp/Syntax/Identifier.cs | 15 -- .../CSharp/Syntax/InvocationAstType.cs | 15 -- .../CSharp/Syntax/MemberType.cs | 15 -- .../CSharp/Syntax/PrimitiveType.cs | 15 -- .../CSharp/Syntax/SimpleType.cs | 15 -- .../Syntax/Statements/BlockStatement.cs | 15 -- .../Syntax/Statements/BreakStatement.cs | 15 -- .../Syntax/Statements/CheckedStatement.cs | 15 -- .../Syntax/Statements/ContinueStatement.cs | 15 -- .../Syntax/Statements/DoWhileStatement.cs | 15 -- .../Syntax/Statements/EmptyStatement.cs | 15 -- .../Syntax/Statements/ExpressionStatement.cs | 15 -- .../Syntax/Statements/FixedStatement.cs | 15 -- .../CSharp/Syntax/Statements/ForStatement.cs | 15 -- .../Syntax/Statements/ForeachStatement.cs | 15 -- .../CSharp/Syntax/Statements/GotoStatement.cs | 45 ------ .../Syntax/Statements/IfElseStatement.cs | 15 -- .../Syntax/Statements/LabelStatement.cs | 15 -- .../LocalFunctionDeclarationStatement.cs | 15 -- .../CSharp/Syntax/Statements/LockStatement.cs | 15 -- .../Syntax/Statements/ReturnStatement.cs | 15 -- .../Syntax/Statements/SwitchStatement.cs | 45 ------ .../Syntax/Statements/ThrowStatement.cs | 15 -- .../Syntax/Statements/TryCatchStatement.cs | 30 ---- .../Syntax/Statements/UncheckedStatement.cs | 15 -- .../Syntax/Statements/UnsafeStatement.cs | 15 -- .../Syntax/Statements/UsingStatement.cs | 15 -- .../VariableDeclarationStatement.cs | 15 -- .../Syntax/Statements/WhileStatement.cs | 15 -- .../Syntax/Statements/YieldBreakStatement.cs | 15 -- .../Syntax/Statements/YieldReturnStatement.cs | 15 -- .../CSharp/Syntax/SyntaxTree.cs | 15 -- .../CSharp/Syntax/TupleAstType.cs | 30 ---- .../TypeMembers/ConstructorDeclaration.cs | 15 -- .../TypeMembers/DestructorDeclaration.cs | 15 -- .../TypeMembers/EnumMemberDeclaration.cs | 15 -- .../Syntax/TypeMembers/EventDeclaration.cs | 30 ---- .../Syntax/TypeMembers/FieldDeclaration.cs | 15 -- .../TypeMembers/FixedFieldDeclaration.cs | 15 -- .../TypeMembers/FixedVariableInitializer.cs | 15 -- .../Syntax/TypeMembers/IndexerDeclaration.cs | 15 -- .../Syntax/TypeMembers/MethodDeclaration.cs | 15 -- .../Syntax/TypeMembers/OperatorDeclaration.cs | 15 -- .../TypeMembers/ParameterDeclaration.cs | 15 -- .../Syntax/TypeMembers/PropertyDeclaration.cs | 15 -- .../Syntax/TypeMembers/VariableInitializer.cs | 15 -- .../CSharp/Syntax/VariableDesignation.cs | 30 ---- 100 files changed, 3 insertions(+), 1804 deletions(-) diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs index c11027f53..5bcd43a0e 100644 --- a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs +++ b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs @@ -144,17 +144,17 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator { builder.Append($@" public override void AcceptVisitor(IAstVisitor visitor) {{ - visitor.Visit{source.NodeName}(this); + visitor.Visit{source.VisitMethodName}(this); }} public override T AcceptVisitor(IAstVisitor visitor) {{ - return visitor.Visit{source.NodeName}(this); + return visitor.Visit{source.VisitMethodName}(this); }} public override S AcceptVisitor(IAstVisitor visitor, T data) {{ - return visitor.Visit{source.NodeName}(this, data); + return visitor.Visit{source.VisitMethodName}(this, data); }} "); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs index 00107dde9..e458f1fbc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/CSharpTokenNode.cs @@ -84,21 +84,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return string.Empty; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCSharpTokenNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCSharpTokenNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCSharpTokenNode(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CSharpTokenNode o = other as CSharpTokenNode; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs index 335ed8982..33ade4c83 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs @@ -130,21 +130,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(PointerRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitComposedType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitComposedType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitComposedType(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ComposedType o = other as ComposedType; @@ -274,21 +259,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBracket); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitArraySpecifier(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitArraySpecifier(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitArraySpecifier(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ArraySpecifier o = other as ArraySpecifier; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs index f677ccb62..550e913ec 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs @@ -134,20 +134,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } return this.Parameters.DoMatch(o.Parameters, match); } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDocumentationReference(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDocumentationReference(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDocumentationReference(this, data); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs index 729f703a0..c409fb69e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs @@ -59,21 +59,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCastExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCastExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCastExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CastExpression o = other as CastExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs index d13774e51..0f674e67b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs @@ -60,21 +60,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCheckedExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCheckedExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCheckedExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CheckedExpression o = other as CheckedExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs index 5a0fe3edc..4e389cfee 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -71,21 +71,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(falseExpression, FalseRole); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitConditionalExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitConditionalExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitConditionalExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ConditionalExpression o = other as ConditionalExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs index b657c9a59..ff325e296 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs @@ -36,21 +36,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.VariableDesignationRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDeclarationExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDeclarationExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDeclarationExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is DeclarationExpression o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs index da7376f1a..f11463b39 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(type, Roles.Type); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDefaultValueExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDefaultValueExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDefaultValueExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { DefaultValueExpression o = other as DefaultValueExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs index faac5001d..5fd051285 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs @@ -79,21 +79,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDirectionExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDirectionExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDirectionExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { DirectionExpression o = other as DirectionExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs index 3536fd897..beece741b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -56,21 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(new Comment(error, CommentType.MultiLine), Roles.Comment); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitErrorNode(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitErrorNode(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitErrorNode(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as ErrorExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs index ba3bbdf0e..7a78d9739 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -65,21 +65,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.TypeArgument); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIdentifierExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIdentifierExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIdentifierExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { IdentifierExpression o = other as IdentifierExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs index 4952df1b7..3d3d01420 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IndexerExpression.cs @@ -71,21 +71,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIndexerExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIndexerExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIndexerExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { IndexerExpression o = other as IndexerExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs index bc82afb08..b790676f5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs @@ -24,21 +24,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Content.AddRange(content); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitInterpolatedStringExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitInterpolatedStringExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitInterpolatedStringExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { InterpolatedStringExpression o = other as InterpolatedStringExpression; @@ -92,21 +77,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Suffix = suffix; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitInterpolation(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitInterpolation(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitInterpolation(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { Interpolation o = other as Interpolation; @@ -129,21 +99,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Text = text; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitInterpolatedStringText(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitInterpolatedStringText(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitInterpolatedStringText(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { InterpolatedStringText o = other as InterpolatedStringText; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs index dd7a299c7..41e0c782a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InvocationExpression.cs @@ -51,21 +51,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RPar); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitInvocationExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitInvocationExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitInvocationExpression(this, data); - } - public InvocationExpression() { } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs index 089e4ebd2..5624ec68b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IsExpression.cs @@ -57,22 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(type, Roles.Type); } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIsExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIsExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIsExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { IsExpression o = other as IsExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs index 9874fd622..2b49a1569 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/LambdaExpression.cs @@ -68,21 +68,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(BodyRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitLambdaExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitLambdaExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitLambdaExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { LambdaExpression o = other as LambdaExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs index 4c6251aa2..656710e61 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/MemberReferenceExpression.cs @@ -98,21 +98,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitMemberReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitMemberReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitMemberReferenceExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { MemberReferenceExpression o = other as MemberReferenceExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs index b1fc18231..cce206d08 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedArgumentExpression.cs @@ -63,21 +63,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNamedArgumentExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNamedArgumentExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNamedArgumentExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { NamedArgumentExpression o = other as NamedArgumentExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs index bdf5cb68d..87d278d13 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NamedExpression.cs @@ -72,21 +72,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNamedExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNamedExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNamedExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as NamedExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs index 14c4e1483..a136fc800 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/NullReferenceExpression.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.location = location; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNullReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNullReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNullReferenceExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { NullReferenceExpression o = other as NullReferenceExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs index da2f559ae..c96b9428e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ObjectCreateExpression.cs @@ -83,21 +83,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitObjectCreateExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitObjectCreateExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitObjectCreateExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ObjectCreateExpression o = other as ObjectCreateExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs index d00d9bce1..28fb3692d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/OutVarDeclarationExpression.cs @@ -50,21 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.Variable = new VariableInitializer(name); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitOutVarDeclarationExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitOutVarDeclarationExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitOutVarDeclarationExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as OutVarDeclarationExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs index 394b43b90..cf17f350e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ParenthesizedExpression.cs @@ -55,21 +55,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Expression = expr; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitParenthesizedExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitParenthesizedExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitParenthesizedExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ParenthesizedExpression o = other as ParenthesizedExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs index 635d975b9..5417245d2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PointerReferenceExpression.cs @@ -66,21 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.TypeArgument); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPointerReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPointerReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPointerReferenceExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { PointerReferenceExpression o = other as PointerReferenceExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs index f53f0525f..153493737 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs @@ -94,21 +94,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.format = format; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPrimitiveExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPrimitiveExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPrimitiveExpression(this, data); - } - unsafe static TextLocation AdvanceLocation(TextLocation startLocation, string str) { int line = startLocation.Line; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs index c0d5f6636..46fc9c106 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs @@ -27,21 +27,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(ClauseRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryExpression o = other as QueryExpression; @@ -102,21 +87,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Identifier); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryContinuationClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryContinuationClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryContinuationClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryContinuationClause o = other as QueryContinuationClause; @@ -161,21 +131,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryFromClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryFromClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryFromClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryFromClause o = other as QueryFromClause; @@ -215,21 +170,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryLetClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryLetClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryLetClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryLetClause o = other as QueryLetClause; @@ -252,21 +192,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Condition, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryWhereClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryWhereClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryWhereClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryWhereClause o = other as QueryWhereClause; @@ -362,21 +287,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(IntoIdentifierRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryJoinClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryJoinClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryJoinClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryJoinClause o = other as QueryJoinClause; @@ -402,21 +312,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(OrderingRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryOrderClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryOrderClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryOrderClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryOrderClause o = other as QueryOrderClause; @@ -448,21 +343,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return Direction == QueryOrderingDirection.Ascending ? GetChildByRole(AscendingKeywordRole) : GetChildByRole(DescendingKeywordRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryOrdering(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryOrdering(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryOrdering(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryOrdering o = other as QueryOrdering; @@ -491,21 +371,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQuerySelectClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQuerySelectClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQuerySelectClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QuerySelectClause o = other as QuerySelectClause; @@ -539,21 +404,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(KeyRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitQueryGroupClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitQueryGroupClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitQueryGroupClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { QueryGroupClause o = other as QueryGroupClause; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs index 85aa497ec..7d5a06552 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/RecursivePatternExpression.cs @@ -41,21 +41,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public bool IsPositional { get; set; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitRecursivePatternExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitRecursivePatternExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitRecursivePatternExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is RecursivePatternExpression o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs index cb5df44f1..817c6c208 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SizeOfExpression.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(type, Roles.Type); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSizeOfExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSizeOfExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSizeOfExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SizeOfExpression o = other as SizeOfExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs index 67e87d087..86a6c4812 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/StackAllocExpression.cs @@ -63,21 +63,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(InitializerRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitStackAllocExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitStackAllocExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitStackAllocExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { StackAllocExpression o = other as StackAllocExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs index 1565ba8ed..c319e8f2f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs @@ -49,21 +49,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSwitchExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSwitchExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSwitchExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SwitchExpression o = other as SwitchExpression; @@ -96,21 +81,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public override NodeType NodeType => NodeType.Unknown; - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSwitchExpressionSection(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSwitchExpressionSection(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSwitchExpressionSection(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SwitchExpressionSection o = other as SwitchExpressionSection; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs index e105d6008..53b9aafde 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThisReferenceExpression.cs @@ -49,21 +49,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitThisReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitThisReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitThisReferenceExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ThisReferenceExpression o = other as ThisReferenceExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs index 9810e6466..5bd7b19cf 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ThrowExpression.cs @@ -44,21 +44,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitThrowExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitThrowExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitThrowExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ThrowExpression o = other as ThrowExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs index c9d21a0b2..14aa07d04 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TupleExpression.cs @@ -27,21 +27,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.Expression); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTupleExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTupleExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTupleExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is TupleExpression tuple diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs index 230691a83..6bdd47a1f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeOfExpression.cs @@ -62,21 +62,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(type, Roles.Type); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTypeOfExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTypeOfExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTypeOfExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { TypeOfExpression o = other as TypeOfExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs index 12bb73297..bf874b2d2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/TypeReferenceExpression.cs @@ -31,21 +31,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Type, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTypeReferenceExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTypeReferenceExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTypeReferenceExpression(this, data); - } - public TypeReferenceExpression() { } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs index ae06ee368..6d3cb7972 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UnaryOperatorExpression.cs @@ -73,21 +73,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUnaryOperatorExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUnaryOperatorExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUnaryOperatorExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UnaryOperatorExpression o = other as UnaryOperatorExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs index 5261ad54e..8cbe40f89 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UncheckedExpression.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUncheckedExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUncheckedExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUncheckedExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UncheckedExpression o = other as UncheckedExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs index 1f127e816..489613a64 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/UndocumentedExpression.cs @@ -81,21 +81,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RPar); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUndocumentedExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUndocumentedExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUndocumentedExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UndocumentedExpression o = other as UndocumentedExpression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs index 3a7fd75ea..3a780b4a3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/WithInitializerExpression.cs @@ -43,21 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(InitializerRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitWithInitializerExpression(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitWithInitializerExpression(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitWithInitializerExpression(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is WithInitializerExpression o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs index b75a39807..743bbbe06 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/FunctionPointerAstType.cs @@ -52,21 +52,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Type, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitFunctionPointerType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitFunctionPointerType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitFunctionPointerType(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { return other is FunctionPointerAstType o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs index 6a7e780c0..2d2704df5 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs @@ -63,21 +63,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAttribute(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAttribute(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAttribute(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { Attribute o = other as Attribute; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs index be9928e4f..a07706c89 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -115,21 +115,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBracket); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitAttributeSection(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitAttributeSection(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitAttributeSection(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { AttributeSection o = other as AttributeSection; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs index d14628202..c2aa2691d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs @@ -129,21 +129,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.endLocation = endLocation; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitComment(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitComment(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitComment(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { Comment o = other as Comment; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs index 1f88c072e..ee2a78ad1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs @@ -59,21 +59,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitConstraint(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitConstraint(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitConstraint(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { Constraint o = other as Constraint; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs index 0ddf262c7..72246b096 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs @@ -66,21 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.Constraint); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDelegateDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDelegateDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDelegateDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { DelegateDeclaration o = other as DelegateDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs index 8c21fc39e..ca82555b3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs @@ -69,21 +69,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitExternAliasDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitExternAliasDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitExternAliasDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as ExternAliasDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs index 34b1590c0..0b319e65c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs @@ -136,21 +136,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(child, MemberRole); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitNamespaceDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitNamespaceDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitNamespaceDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { NamespaceDeclaration o = other as NamespaceDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs index 81a850fed..3ba9af307 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs @@ -181,21 +181,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.Argument = argument; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPreProcessorDirective(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPreProcessorDirective(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPreProcessorDirective(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { PreProcessorDirective o = other as PreProcessorDirective; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs index 7c90d7294..32d00fdb4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs @@ -133,21 +133,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTypeDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTypeDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTypeDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { TypeDeclaration o = other as TypeDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs index 4f65c7d55..eba6864a8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs @@ -90,21 +90,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax Name = name; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTypeParameterDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTypeParameterDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTypeParameterDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { TypeParameterDeclaration o = other as TypeParameterDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs index 12a69b56a..2a90d0023 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs @@ -85,21 +85,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(import, ImportRole); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUsingAliasDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUsingAliasDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUsingAliasDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UsingAliasDeclaration o = other as UsingAliasDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs index f0cbacf54..f337e3466 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs @@ -101,21 +101,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(import, ImportRole); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUsingDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUsingDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUsingDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UsingDeclaration o = other as UsingDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs index 8d884f470..b99e4d2b6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs @@ -120,21 +120,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return new Identifier(name, location); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIdentifier(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIdentifier(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIdentifier(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { Identifier o = other as Identifier; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs index c83d314c6..ec3e7616e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/InvocationAstType.cs @@ -39,21 +39,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Type, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitInvocationType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitInvocationType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitInvocationType(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is InvocationAstType o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs index bcb46d976..3ac178878 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/MemberType.cs @@ -98,21 +98,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitMemberType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitMemberType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitMemberType(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { MemberType o = other as MemberType; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs index fa600eee6..bbf30fd36 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/PrimitiveType.cs @@ -86,21 +86,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPrimitiveType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPrimitiveType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPrimitiveType(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { PrimitiveType o = other as PrimitiveType; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs index b86342ddd..28f55b587 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SimpleType.cs @@ -89,21 +89,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.TypeArgument); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSimpleType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSimpleType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSimpleType(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SimpleType o = other as SimpleType; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index 032bcb7e5..37a6f3244 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -94,21 +94,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitBlockStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitBlockStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitBlockStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { BlockStatement o = other as BlockStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs index 8bb7127e5..88b2b3238 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BreakStatement.cs @@ -43,21 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitBreakStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitBreakStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitBreakStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { BreakStatement o = other as BreakStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs index 286301d90..9af92d1d4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/CheckedStatement.cs @@ -53,21 +53,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(body, Roles.Body); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCheckedStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCheckedStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCheckedStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CheckedStatement o = other as CheckedStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs index 8d2011abf..57a1251a1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ContinueStatement.cs @@ -43,21 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitContinueStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitContinueStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitContinueStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ContinueStatement o = other as ContinueStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs index 59a6e43aa..6319fab85 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/DoWhileStatement.cs @@ -66,21 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDoWhileStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDoWhileStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDoWhileStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { DoWhileStatement o = other as DoWhileStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs index 41168a8e0..4da13ae7b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/EmptyStatement.cs @@ -50,21 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitEmptyStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitEmptyStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitEmptyStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { EmptyStatement o = other as EmptyStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs index f5149d576..563fcc63e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ExpressionStatement.cs @@ -42,21 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitExpressionStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitExpressionStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitExpressionStatement(this, data); - } - public ExpressionStatement() { } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs index 76abd6c0c..ff098821a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/FixedStatement.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitFixedStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitFixedStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitFixedStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { FixedStatement o = other as FixedStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs index 030a59dc8..97aef87c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForStatement.cs @@ -72,21 +72,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitForStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitForStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitForStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ForStatement o = other as ForStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs index 4abb0a936..e447f805a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ForeachStatement.cs @@ -82,21 +82,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitForeachStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitForeachStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitForeachStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ForeachStatement o = other as ForeachStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs index 0f9b373f1..d5a538c12 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/GotoStatement.cs @@ -64,21 +64,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitGotoStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitGotoStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitGotoStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { GotoStatement o = other as GotoStatement; @@ -115,21 +100,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitGotoCaseStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitGotoCaseStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitGotoCaseStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { GotoCaseStatement o = other as GotoCaseStatement; @@ -158,21 +128,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitGotoDefaultStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitGotoDefaultStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitGotoDefaultStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { GotoDefaultStatement o = other as GotoDefaultStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs index dd85ad91d..b76511bbc 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/IfElseStatement.cs @@ -70,21 +70,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(FalseRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIfElseStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIfElseStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIfElseStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { IfElseStatement o = other as IfElseStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs index d9b34f059..55ce57682 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LabelStatement.cs @@ -51,21 +51,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Colon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitLabelStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitLabelStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitLabelStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { LabelStatement o = other as LabelStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs index 20b8939fc..052e7877f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LocalFunctionDeclarationStatement.cs @@ -35,21 +35,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(methodDeclaration, MethodDeclarationRole); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitLocalFunctionDeclarationStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitLocalFunctionDeclarationStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitLocalFunctionDeclarationStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is LocalFunctionDeclarationStatement o && Declaration.DoMatch(o.Declaration, match); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs index d6defd83f..3151920c8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/LockStatement.cs @@ -57,21 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitLockStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitLockStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitLockStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { LockStatement o = other as LockStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs index a68c96b32..51ac889c7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ReturnStatement.cs @@ -57,21 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(returnExpression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitReturnStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitReturnStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitReturnStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ReturnStatement o = other as ReturnStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs index cc40c653d..4da46969f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs @@ -65,21 +65,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSwitchStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSwitchStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSwitchStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SwitchStatement o = other as SwitchStatement; @@ -152,21 +137,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(Roles.EmbeddedStatement); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSwitchSection(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSwitchSection(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSwitchSection(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { SwitchSection o = other as SwitchSection; @@ -207,21 +177,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.Expression = expression; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCaseLabel(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCaseLabel(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCaseLabel(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CaseLabel o = other as CaseLabel; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs index e5f19aef9..7c5dde36c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/ThrowStatement.cs @@ -57,21 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitThrowStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitThrowStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitThrowStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ThrowStatement o = other as ThrowStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index b6ae5db04..91a8733e8 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -61,21 +61,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(FinallyBlockRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTryCatchStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTryCatchStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTryCatchStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { TryCatchStatement o = other as TryCatchStatement; @@ -205,21 +190,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCatchClause(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCatchClause(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCatchClause(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CatchClause o = other as CatchClause; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs index 5f5197bbf..47f03ccd1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UncheckedStatement.cs @@ -53,21 +53,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(body, Roles.Body); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUncheckedStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUncheckedStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUncheckedStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UncheckedStatement o = other as UncheckedStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs index d0b5a7a72..f98a1a372 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UnsafeStatement.cs @@ -44,21 +44,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUnsafeStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUnsafeStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUnsafeStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UnsafeStatement o = other as UnsafeStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs index d900c3a22..71843602d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/UsingStatement.cs @@ -73,21 +73,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitUsingStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitUsingStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitUsingStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { UsingStatement o = other as UsingStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs index b9ed5d164..d523f6069 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/VariableDeclarationStatement.cs @@ -65,21 +65,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return Variables.FirstOrNullObject(vi => vi.Name == name); } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitVariableDeclarationStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitVariableDeclarationStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitVariableDeclarationStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { VariableDeclarationStatement o = other as VariableDeclarationStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs index 8bdcd5f25..29f8233e9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/WhileStatement.cs @@ -57,21 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.EmbeddedStatement, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitWhileStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitWhileStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitWhileStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { WhileStatement o = other as WhileStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs index 5a45f6d3f..db5dbf34a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldBreakStatement.cs @@ -48,21 +48,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitYieldBreakStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitYieldBreakStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitYieldBreakStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { YieldBreakStatement o = other as YieldBreakStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs index fa25ddbe1..aea77e7a2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/YieldReturnStatement.cs @@ -53,21 +53,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.Semicolon); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitYieldReturnStatement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitYieldReturnStatement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitYieldReturnStatement(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { YieldReturnStatement o = other as YieldReturnStatement; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs index bde54a30b..f5d0294ae 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs @@ -122,20 +122,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax SyntaxTree o = other as SyntaxTree; return o != null && this.Members.DoMatch(o.Members, match); } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSyntaxTree(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSyntaxTree(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSyntaxTree(this, data); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs index fcdaacc64..3601518b9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs @@ -34,21 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(ElementRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTupleType(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTupleType(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTupleType(this, data); - } - public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider = null) { return new TupleTypeReference( @@ -83,21 +68,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public override NodeType NodeType => NodeType.Unknown; - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitTupleTypeElement(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitTupleTypeElement(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitTupleTypeElement(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is TupleTypeElement o diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs index b1fd821e0..bb0832b38 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs @@ -116,21 +116,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RPar); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitConstructorInitializer(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitConstructorInitializer(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitConstructorInitializer(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { ConstructorInitializer o = other as ConstructorInitializer; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs index ac3657e59..ca18b395f 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/DestructorDeclaration.cs @@ -53,21 +53,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitDestructorDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitDestructorDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitDestructorDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { DestructorDeclaration o = other as DestructorDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs index ab6f0e3c1..6344464a1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EnumMemberDeclaration.cs @@ -46,21 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(InitializerRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitEnumMemberDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitEnumMemberDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitEnumMemberDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { EnumMemberDeclaration o = other as EnumMemberDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs index 0a5bc1b50..62957aafd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -62,21 +62,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { throw new NotSupportedException(); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitEventDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitEventDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitEventDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { EventDeclaration o = other as EventDeclaration; @@ -126,21 +111,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBrace); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitCustomEventDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitCustomEventDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitCustomEventDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { CustomEventDeclaration o = other as CustomEventDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs index 840743e82..ea0de51be 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FieldDeclaration.cs @@ -56,21 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { throw new NotSupportedException(); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitFieldDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitFieldDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitFieldDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { FieldDeclaration o = other as FieldDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs index 1ed741e24..a829b05f3 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedFieldDeclaration.cs @@ -45,21 +45,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildrenByRole(VariableRole); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitFixedFieldDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitFixedFieldDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitFixedFieldDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as FixedFieldDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs index 08b9938cd..4ef6867cd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs @@ -80,21 +80,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RBracket); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitFixedVariableInitializer(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitFixedVariableInitializer(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitFixedVariableInitializer(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { var o = other as FixedVariableInitializer; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs index c3ad4ea6c..e2300b4ef 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -102,21 +102,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(ExpressionBodyRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitIndexerDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitIndexerDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitIndexerDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { IndexerDeclaration o = other as IndexerDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs index 0c3fc1149..61f4def45 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -76,21 +76,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitMethodDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitMethodDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitMethodDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { MethodDeclaration o = other as MethodDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs index 85719e5b7..a6ec8eb50 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -328,21 +328,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return names[(int)type][0]; } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitOperatorDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitOperatorDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitOperatorDeclaration(this, data); - } - public override string Name { get { return GetName(this.OperatorType); } set { throw new NotSupportedException(); } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs index 3394aa94d..4f02ef800 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -174,21 +174,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitParameterDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitParameterDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitParameterDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) { var o = other as ParameterDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs index daa35edb0..93ab7edcb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -83,21 +83,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(ExpressionBodyRole, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPropertyDeclaration(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPropertyDeclaration(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPropertyDeclaration(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { PropertyDeclaration o = other as PropertyDeclaration; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index efdb31317..0e51e9299 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -119,21 +119,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Expression, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitVariableInitializer(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitVariableInitializer(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitVariableInitializer(this, data); - } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { VariableInitializer o = other as VariableInitializer; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs index 2fa76e8c7..a4234f3aa 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs @@ -42,21 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Identifier, value); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitSingleVariableDesignation(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitSingleVariableDesignation(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitSingleVariableDesignation(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is SingleVariableDesignation o && MatchString(this.Identifier, o.Identifier); @@ -82,21 +67,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.RPar); } } - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitParenthesizedVariableDesignation(this); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitParenthesizedVariableDesignation(this); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitParenthesizedVariableDesignation(this, data); - } - protected internal override bool DoMatch(AstNode other, Match match) { return other is ParenthesizedVariableDesignation o && VariableDesignations.DoMatch(o.VariableDesignations, match); From 80e8bcb77b26963abaa42ca7757d8930295900fd Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 01:12:09 +0200 Subject: [PATCH 09/15] Generate PatternPlaceholder nodes --- .../DecompilerAstNodeAttribute.cs | 2 +- .../DecompilerSyntaxTreeGenerator.cs | 69 ++++++++++++++++++- .../CSharp/Syntax/AstNode.cs | 48 +------------ .../CSharp/Syntax/AstType.cs | 55 +-------------- .../Expressions/ArrayInitializerExpression.cs | 46 ------------- .../CSharp/Syntax/Expressions/Expression.cs | 48 +------------ .../Syntax/GeneralScope/AttributeSection.cs | 48 +------------ .../Syntax/Statements/BlockStatement.cs | 48 +------------ .../CSharp/Syntax/Statements/Statement.cs | 48 +------------ .../Syntax/Statements/SwitchStatement.cs | 48 +------------ .../Syntax/Statements/TryCatchStatement.cs | 48 +------------ .../TypeMembers/ParameterDeclaration.cs | 48 +------------ .../Syntax/TypeMembers/VariableInitializer.cs | 48 +------------ 13 files changed, 78 insertions(+), 526 deletions(-) diff --git a/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs b/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs index b0d1924dc..c81232de2 100644 --- a/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs +++ b/ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs @@ -4,7 +4,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { public sealed class DecompilerAstNodeAttribute : Attribute { - public DecompilerAstNodeAttribute(bool hasNullNode) { } + public DecompilerAstNodeAttribute(bool hasNullNode = false, bool hasPatternPlaceholder = false) { } } public sealed class ExcludeFromMatchAttribute : Attribute diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs index 5bcd43a0e..9a8788058 100644 --- a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs +++ b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs @@ -14,7 +14,7 @@ namespace ICSharpCode.Decompiler.Generators; [Generator] internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator { - record AstNodeAdditions(string NodeName, bool NeedsAcceptImpls, bool NeedsVisitor, bool NeedsNullNode, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? MembersToMatch); + record AstNodeAdditions(string NodeName, bool NeedsAcceptImpls, bool NeedsVisitor, bool NeedsNullNode, bool NeedsPatternPlaceholder, int NullNodeBaseCtorParamCount, bool IsTypeNode, string VisitMethodName, string VisitMethodParamType, EquatableArray<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny)>? MembersToMatch); AstNodeAdditions GetAstNodeAdditions(GeneratorAttributeSyntaxContext context, CancellationToken ct) { @@ -63,6 +63,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator return new(targetSymbol.Name, !targetSymbol.MemberNames.Contains("AcceptVisitor"), NeedsVisitor: !targetSymbol.IsAbstract && targetSymbol.BaseType!.IsAbstract, NeedsNullNode: (bool)attribute.ConstructorArguments[0].Value!, + NeedsPatternPlaceholder: (bool)attribute.ConstructorArguments[1].Value!, NullNodeBaseCtorParamCount: targetSymbol.InstanceConstructors.Min(m => m.Parameters.Length), IsTypeNode: targetSymbol.Name == "AstType" || targetSymbol.BaseType?.Name == "AstType", visitMethodName, paramTypeName, membersToMatch?.ToEquatableArray()); @@ -75,6 +76,13 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); builder.AppendLine(); + if (source.NeedsPatternPlaceholder) + { + builder.AppendLine("using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching;"); + } + + builder.AppendLine(); + builder.AppendLine("#nullable enable"); builder.AppendLine(); @@ -140,6 +148,63 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator } + if (source.NeedsPatternPlaceholder) + { + const string toTypeReferenceCode = @" + + public override Decompiler.TypeSystem.ITypeReference ToTypeReference(Resolver.NameLookupMode lookupMode, Decompiler.TypeSystem.InterningProvider? interningProvider = null) + { + throw new System.NotSupportedException(); + }"; + + builder.Append( + $@" public static implicit operator {source.NodeName}?(PatternMatching.Pattern? pattern) + {{ + return pattern != null ? new PatternPlaceholder(pattern) : null; + }} + + sealed class PatternPlaceholder : {source.NodeName}, INode + {{ + readonly PatternMatching.Pattern child; + + public PatternPlaceholder(PatternMatching.Pattern child) + {{ + this.child = child; + }} + + public override NodeType NodeType {{ + get {{ return NodeType.Pattern; }} + }} + + public override void AcceptVisitor(IAstVisitor visitor) + {{ + visitor.VisitPatternPlaceholder(this, child); + }} + + public override T AcceptVisitor(IAstVisitor visitor) + {{ + return visitor.VisitPatternPlaceholder(this, child); + }} + + public override S AcceptVisitor(IAstVisitor visitor, T data) + {{ + return visitor.VisitPatternPlaceholder(this, child, data); + }} + + protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) + {{ + return child.DoMatch(other, match); + }} + + bool PatternMatching.INode.DoMatchCollection(Role? role, PatternMatching.INode? pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) + {{ + return child.DoMatchCollection(role, pos, match, backtrackingInfo); + }}{(source.NodeName == "AstType" ? toTypeReferenceCode : "")} + }} +" + ); + } + if (source.NeedsAcceptImpls && source.NeedsVisitor) { builder.Append($@" public override void AcceptVisitor(IAstVisitor visitor) @@ -202,7 +267,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator builder.AppendLine("namespace ICSharpCode.Decompiler.CSharp.Syntax;"); source = source - .Concat([new("NullNode", false, true, false, 0, false, "NullNode", "AstNode", null), new("PatternPlaceholder", false, true, false, 0, false, "PatternPlaceholder", "AstNode", null)]) + .Concat([new("NullNode", false, true, false, false, 0, false, "NullNode", "AstNode", null), new("PatternPlaceholder", false, true, false, false, 0, false, "PatternPlaceholder", "AstNode", null)]) .ToImmutableArray(); WriteInterface("IAstVisitor", "void", ""); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs index 0f5666c8e..605f6b8e7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs @@ -37,58 +37,12 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public abstract partial class AstNode : AbstractAnnotatable, IFreezable, INode, ICloneable { // the Root role must be available when creating the null nodes, so we can't put it in the Roles class internal static readonly Role RootRole = new Role("Root", null); - #region PatternPlaceholder - public static implicit operator AstNode?(PatternMatching.Pattern? pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : AstNode, INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role? role, PatternMatching.INode? pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - AstNode? parent; AstNode? prevSibling; AstNode? nextSibling; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs index 9766e0d77..a8f5cdc97 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs @@ -16,11 +16,9 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System; using System.Collections.Generic; using ICSharpCode.Decompiler.CSharp.Resolver; -using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -28,60 +26,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// A type reference in the C# AST. /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public abstract partial class AstType : AstNode { - #region PatternPlaceholder - public static implicit operator AstType(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : AstType, INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - public override ITypeReference ToTypeReference(NameLookupMode lookupMode, InterningProvider interningProvider) - { - throw new NotSupportedException(); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType { get { return NodeType.TypeReference; } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index 9c5458af8..3f29a2c1b 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -94,52 +94,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - - #region PatternPlaceholder - public static implicit operator ArrayInitializerExpression(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : ArrayInitializerExpression, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs index 54c5bfb5e..f73e50549 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs @@ -27,55 +27,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be an expression" /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public abstract partial class Expression : AstNode { - #region PatternPlaceholder - public static implicit operator Expression(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : Expression, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType { get { return NodeType.Expression; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs index a07706c89..2b74052b1 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs @@ -30,55 +30,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// [AttributeTarget: Attributes] /// - [DecompilerAstNode(hasNullNode: false)] + [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class AttributeSection : AstNode { - #region PatternPlaceholder - public static implicit operator AttributeSection(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : AttributeSection, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType { get { return NodeType.Unknown; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs index 37a6f3244..e57fa6ad9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/BlockStatement.cs @@ -31,57 +31,11 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Statements } /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class BlockStatement : Statement, IEnumerable { public static readonly Role StatementRole = new Role("Statement", Statement.Null); - #region PatternPlaceholder - public static implicit operator BlockStatement(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : BlockStatement, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public CSharpTokenNode LBraceToken { get { return GetChildByRole(Roles.LBrace); } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs index 7767a5590..49f87dfaa 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs @@ -27,55 +27,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// This class is useful even though it doesn't provide any additional functionality: /// It can be used to communicate more information in APIs, e.g. "this subnode will always be a statement" /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public abstract partial class Statement : AstNode { - #region PatternPlaceholder - public static implicit operator Statement(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : Statement, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public new Statement Clone() { return (Statement)base.Clone(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs index 4da46969f..53af944eb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs @@ -72,55 +72,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - [DecompilerAstNode(hasNullNode: false)] + [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class SwitchSection : AstNode { - #region PatternPlaceholder - public static implicit operator SwitchSection(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : SwitchSection, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public static readonly Role CaseLabelRole = new Role("CaseLabel", null); public override NodeType NodeType { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs index 91a8733e8..1a21e7c13 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs @@ -71,7 +71,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// catch (Type VariableName) { Body } /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class CatchClause : AstNode { public static readonly TokenRole CatchKeywordRole = new TokenRole("catch"); @@ -80,52 +80,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public static readonly TokenRole CondLPar = new TokenRole("("); public static readonly TokenRole CondRPar = new TokenRole(")"); - #region PatternPlaceholder - public static implicit operator CatchClause(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : CatchClause, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType { get { return NodeType.Unknown; diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs index 4f02ef800..d9d0cf1fa 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs @@ -30,7 +30,7 @@ using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(hasNullNode: false)] + [DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)] public partial class ParameterDeclaration : AstNode { public static readonly Role AttributeRole = EntityDeclaration.AttributeRole; @@ -42,52 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public static readonly TokenRole InModifierRole = new TokenRole("in"); public static readonly TokenRole ParamsModifierRole = new TokenRole("params"); - #region PatternPlaceholder - public static implicit operator ParameterDeclaration?(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : ParameterDeclaration, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode? other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType => NodeType.Unknown; public AstNodeCollection Attributes { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs index 0e51e9299..ee2d6166c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs @@ -27,55 +27,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class VariableInitializer : AstNode { - #region PatternPlaceholder - public static implicit operator VariableInitializer(PatternMatching.Pattern pattern) - { - return pattern != null ? new PatternPlaceholder(pattern) : null; - } - - sealed class PatternPlaceholder : VariableInitializer, PatternMatching.INode - { - readonly PatternMatching.Pattern child; - - public PatternPlaceholder(PatternMatching.Pattern child) - { - this.child = child; - } - - public override NodeType NodeType { - get { return NodeType.Pattern; } - } - - public override void AcceptVisitor(IAstVisitor visitor) - { - visitor.VisitPatternPlaceholder(this, child); - } - - public override T AcceptVisitor(IAstVisitor visitor) - { - return visitor.VisitPatternPlaceholder(this, child); - } - - public override S AcceptVisitor(IAstVisitor visitor, T data) - { - return visitor.VisitPatternPlaceholder(this, child, data); - } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - return child.DoMatch(other, match); - } - - bool PatternMatching.INode.DoMatchCollection(Role role, PatternMatching.INode pos, PatternMatching.Match match, PatternMatching.BacktrackingInfo backtrackingInfo) - { - return child.DoMatchCollection(role, pos, match, backtrackingInfo); - } - } - #endregion - public override NodeType NodeType { get { return NodeType.Unknown; From 5d2121a1a9f87bfaa698a5995ea16ae2b0b4710d Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 01:26:48 +0200 Subject: [PATCH 10/15] fixup pattern place --- .../CSharp/Syntax/Expressions/ArrayInitializerExpression.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index 3f29a2c1b..e76745012 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -31,7 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// { Elements } /// - [DecompilerAstNode(hasNullNode: true)] + [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class ArrayInitializerExpression : Expression { /// From 1a1980a04cabc1934bb18d94bb841ab2db965aa1 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 01:32:48 +0200 Subject: [PATCH 11/15] Remove some unused members --- .../Expressions/ArrayInitializerExpression.cs | 29 ------------------- ICSharpCode.Decompiler/CSharp/Syntax/Role.cs | 9 ------ .../Syntax/TypeMembers/EntityDeclaration.cs | 2 ++ 3 files changed, 2 insertions(+), 38 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index e76745012..53b06f1e4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -34,18 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)] public partial class ArrayInitializerExpression : Expression { - /// - /// For ease of use purposes in the resolver the ast representation - /// of { a, b, c } is { {a}, {b}, {c} }. - /// If IsSingleElement is true then this array initializer expression is a generated one. - /// That has no meaning in the source code (and contains no brace tokens). - /// - public virtual bool IsSingleElement { - get { - return false; - } - } - public ArrayInitializerExpression() { } @@ -77,23 +65,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax ArrayInitializerExpression o = other as ArrayInitializerExpression; return o != null && this.Elements.DoMatch(o.Elements, match); } - - public static ArrayInitializerExpression CreateSingleElementInitializer() - { - return new SingleArrayInitializerExpression(); - } - /// - /// Single elements in array initializers are represented with this special class. - /// - class SingleArrayInitializerExpression : ArrayInitializerExpression - { - public override bool IsSingleElement { - get { - return true; - } - } - - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Role.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Role.cs index 2411a2652..aec5a1f0c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Role.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Role.cs @@ -88,15 +88,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return node is T; } - [Obsolete("Use the other overload explicitly specifying the nullObject.")] - public Role(string name) - { - if (name == null) - throw new ArgumentNullException(nameof(name)); - this.name = name; - this.nullObject = null!; - } - public Role(string name, T nullObject) { this.name = name ?? throw new ArgumentNullException(nameof(name)); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs index 28cfb0798..b2670a956 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs @@ -16,6 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. +using System; using System.Collections.Generic; using System.Linq; @@ -33,6 +34,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return NodeType.Member; } } + [Obsolete] public abstract SymbolKind SymbolKind { get; } public AstNodeCollection Attributes { From bcac87c8f00362cdb6069efe4fd47e4418a595bb Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 01:33:43 +0200 Subject: [PATCH 12/15] Add AccessorKind to make Accessor keywords independent of their role. --- .../CSharp/Syntax/TypeMembers/Accessor.cs | 38 ++++++++++++------- .../CSharp/Syntax/TypeSystemAstBuilder.cs | 22 ++++++----- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs index 7019beddd..bbdb172fd 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs @@ -24,10 +24,22 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +#nullable enable + using ICSharpCode.Decompiler.TypeSystem; namespace ICSharpCode.Decompiler.CSharp.Syntax { + public enum AccessorKind + { + Any, + Getter, + Setter, + Init, + Adder, + Remover + } + /// /// get/set/init/add/remove /// @@ -42,21 +54,15 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return SymbolKind.Method; } } + public AccessorKind Kind { get; set; } + /// /// Gets the 'get'/'set'/'init'/'add'/'remove' keyword /// public CSharpTokenNode Keyword { get { - for (AstNode child = this.FirstChild; child != null; child = child.NextSibling) - { - if (child.Role == PropertyDeclaration.GetKeywordRole || child.Role == PropertyDeclaration.SetKeywordRole - || child.Role == PropertyDeclaration.InitKeywordRole - || child.Role == CustomEventDeclaration.AddKeywordRole || child.Role == CustomEventDeclaration.RemoveKeywordRole) - { - return (CSharpTokenNode)child; - } - } - return CSharpTokenNode.Null; + var role = GetAccessorKeywordRole(Kind); + return role == null ? CSharpTokenNode.Null : GetChildByRole(role); } } @@ -65,10 +71,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(Roles.Body, value); } } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) + public static TokenRole? GetAccessorKeywordRole(AccessorKind kind) { - Accessor o = other as Accessor; - return o != null && !o.IsNull && this.MatchAttributesAndModifiers(o, match) && this.Body.DoMatch(o.Body, match); + return kind switch { + AccessorKind.Getter => PropertyDeclaration.GetKeywordRole, + AccessorKind.Setter => PropertyDeclaration.SetKeywordRole, + AccessorKind.Init => PropertyDeclaration.InitKeywordRole, + AccessorKind.Adder => CustomEventDeclaration.AddKeywordRole, + AccessorKind.Remover => CustomEventDeclaration.RemoveKeywordRole, + _ => null, + }; } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs index 119185bc5..07ef4484c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs @@ -2082,22 +2082,24 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax decl.Modifiers = ModifierFromAccessibility(accessor.Accessibility, UsePrivateProtectedAccessibility); if (this.ShowModifiers && accessor.HasReadonlyModifier()) decl.Modifiers |= Modifiers.Readonly; - TokenRole keywordRole = kind switch { - MethodSemanticsAttributes.Getter => PropertyDeclaration.GetKeywordRole, - MethodSemanticsAttributes.Setter => PropertyDeclaration.SetKeywordRole, - MethodSemanticsAttributes.Adder => CustomEventDeclaration.AddKeywordRole, - MethodSemanticsAttributes.Remover => CustomEventDeclaration.RemoveKeywordRole, - _ => null + AccessorKind accessorKind = kind switch { + MethodSemanticsAttributes.Getter => AccessorKind.Getter, + MethodSemanticsAttributes.Setter => AccessorKind.Setter, + MethodSemanticsAttributes.Adder => AccessorKind.Adder, + MethodSemanticsAttributes.Remover => AccessorKind.Remover, + _ => AccessorKind.Any }; if (kind == MethodSemanticsAttributes.Setter && SupportInitAccessors && accessor.IsInitOnly) { - keywordRole = PropertyDeclaration.InitKeywordRole; + accessorKind = AccessorKind.Init; } - if (keywordRole != null) + decl.Kind = accessorKind; + if (accessorKind != AccessorKind.Any) { - decl.AddChild(new CSharpTokenNode(TextLocation.Empty, keywordRole), keywordRole); + var tokenKind = Accessor.GetAccessorKeywordRole(accessorKind); + decl.AddChild(new CSharpTokenNode(TextLocation.Empty, tokenKind), tokenKind); } - if (accessor.IsInitOnly && keywordRole != PropertyDeclaration.InitKeywordRole) + if (accessor.IsInitOnly && accessorKind != AccessorKind.Init) { decl.AddChild(new Comment("init", CommentType.MultiLine), Roles.Comment); } From 31ebba1fbf8d4b8ccd5083626f91478be32416b1 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 5 May 2025 01:35:43 +0200 Subject: [PATCH 13/15] DoMatch 1 --- .../Syntax/Expressions/AnonymousMethodExpression.cs | 7 ------- .../Syntax/Expressions/AnonymousTypeCreateExpression.cs | 6 ------ .../CSharp/Syntax/Expressions/ArrayCreateExpression.cs | 9 --------- .../Syntax/Expressions/ArrayInitializerExpression.cs | 6 ------ .../CSharp/Syntax/Expressions/AsExpression.cs | 8 -------- .../CSharp/Syntax/Expressions/AssignmentExpression.cs | 8 -------- .../CSharp/Syntax/Expressions/BaseReferenceExpression.cs | 7 ------- .../Syntax/Expressions/BinaryOperatorExpression.cs | 7 ------- 8 files changed, 58 deletions(-) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs index 34caf0551..964a4fd2a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousMethodExpression.cs @@ -94,12 +94,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public AnonymousMethodExpression(BlockStatement body, params ParameterDeclaration[] parameters) : this(body, (IEnumerable)parameters) { } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - AnonymousMethodExpression o = other as AnonymousMethodExpression; - return o != null && this.IsAsync == o.IsAsync && this.HasParameterList == o.HasParameterList - && this.Parameters.DoMatch(o.Parameters, match) && this.Body.DoMatch(o.Body, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs index 908ddb6fe..0160c3b25 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AnonymousTypeCreateExpression.cs @@ -66,12 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public AnonymousTypeCreateExpression(params Expression[] initializer) : this((IEnumerable)initializer) { } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - var o = other as AnonymousTypeCreateExpression; - return o != null && this.Initializers.DoMatch(o.Initializers, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs index aece68c6b..de1a58ff7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayCreateExpression.cs @@ -16,7 +16,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// @@ -54,13 +53,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(InitializerRole); } set { SetChildByRole(InitializerRole, value); } } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - ArrayCreateExpression o = other as ArrayCreateExpression; - return o != null && this.Type.DoMatch(o.Type, match) - && this.Arguments.DoMatch(o.Arguments, match) - && this.AdditionalArraySpecifiers.DoMatch(o.AdditionalArraySpecifiers, match) - && this.Initializer.DoMatch(o.Initializer, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs index 53b06f1e4..3702f18cb 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ArrayInitializerExpression.cs @@ -59,12 +59,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public CSharpTokenNode RBraceToken { get { return GetChildByRole(Roles.RBrace); } } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - ArrayInitializerExpression o = other as ArrayInitializerExpression; - return o != null && this.Elements.DoMatch(o.Elements, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs index 1ec95755b..13666c173 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AsExpression.cs @@ -23,8 +23,6 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System.Collections.Generic; - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// @@ -58,12 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(expression, Roles.Expression); AddChild(type, Roles.Type); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - AsExpression o = other as AsExpression; - return o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs index 839cafae8..56c4eba2a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/AssignmentExpression.cs @@ -25,7 +25,6 @@ // THE SOFTWARE. using System; -using System.Collections.Generic; using System.Linq.Expressions; namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -89,13 +88,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(RightRole, value); } } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - AssignmentExpression o = other as AssignmentExpression; - return o != null && (this.Operator == AssignmentOperatorType.Any || this.Operator == o.Operator) - && this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match); - } - public static TokenRole GetOperatorRole(AssignmentOperatorType op) { switch (op) diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs index 82cf0fc0a..ace2c05d9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BaseReferenceExpression.cs @@ -24,7 +24,6 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// @@ -48,11 +47,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax return new TextLocation(Location.Line, Location.Column + "base".Length); } } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - BaseReferenceExpression o = other as BaseReferenceExpression; - return o != null; - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs index 2c98080f1..af73340e4 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/BinaryOperatorExpression.cs @@ -91,13 +91,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax set { SetChildByRole(RightRole, value); } } - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - BinaryOperatorExpression o = other as BinaryOperatorExpression; - return o != null && (this.Operator == BinaryOperatorType.Any || this.Operator == o.Operator) - && this.Left.DoMatch(o.Left, match) && this.Right.DoMatch(o.Right, match); - } - public static TokenRole GetOperatorRole(BinaryOperatorType op) { switch (op) From 0541e53b1da2f291eb69f66a8f57109623eba5a2 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 6 May 2025 20:01:47 +0200 Subject: [PATCH 14/15] WIP --- .../DecompilerSyntaxTreeGenerator.cs | 4 ++++ .../CSharp/Syntax/Expressions/CastExpression.cs | 6 ------ .../CSharp/Syntax/Expressions/CheckedExpression.cs | 6 ------ .../Syntax/Expressions/ConditionalExpression.cs | 6 ------ .../Syntax/Expressions/DeclarationExpression.cs | 9 --------- .../Syntax/Expressions/DefaultValueExpression.cs | 6 ------ .../CSharp/Syntax/Expressions/DirectionExpression.cs | 6 ------ .../CSharp/Syntax/Expressions/ErrorExpression.cs | 11 ----------- .../CSharp/Syntax/Expressions/IdentifierExpression.cs | 6 ------ 9 files changed, 4 insertions(+), 56 deletions(-) diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs index 9a8788058..ed227b617 100644 --- a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs +++ b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs @@ -244,6 +244,10 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator { builder.Append($"\r\n\t\t\t&& (this.{member} == {typeName}.Any || this.{member} == o.{member})"); } + else if (typeName == "String") + { + builder.Append($"\r\n\t\t\t&& MatchString(this.{member}, o.{member})"); + } else { builder.Append($"\r\n\t\t\t&& this.{member} == o.{member}"); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs index c409fb69e..b8d05a715 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CastExpression.cs @@ -58,12 +58,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(castToType, Roles.Type); AddChild(expression, Roles.Expression); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - CastExpression o = other as CastExpression; - return o != null && this.Type.DoMatch(o.Type, match) && this.Expression.DoMatch(o.Expression, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs index 0f674e67b..dacceb8c9 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/CheckedExpression.cs @@ -59,11 +59,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { AddChild(expression, Roles.Expression); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - CheckedExpression o = other as CheckedExpression; - return o != null && this.Expression.DoMatch(o.Expression, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs index 4e389cfee..809312b9e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ConditionalExpression.cs @@ -70,11 +70,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax AddChild(trueExpression, TrueRole); AddChild(falseExpression, FalseRole); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - ConditionalExpression o = other as ConditionalExpression; - return o != null && this.Condition.DoMatch(o.Condition, match) && this.TrueExpression.DoMatch(o.TrueExpression, match) && this.FalseExpression.DoMatch(o.FalseExpression, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs index ff325e296..c24382f8d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DeclarationExpression.cs @@ -16,8 +16,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching; - namespace ICSharpCode.Decompiler.CSharp.Syntax { /// @@ -35,12 +33,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return GetChildByRole(Roles.VariableDesignationRole); } set { SetChildByRole(Roles.VariableDesignationRole, value); } } - - protected internal override bool DoMatch(AstNode other, Match match) - { - return other is DeclarationExpression o - && Type.DoMatch(o.Type, match) - && Designation.DoMatch(o.Designation, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs index f11463b39..6e310505e 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DefaultValueExpression.cs @@ -60,12 +60,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { AddChild(type, Roles.Type); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - DefaultValueExpression o = other as DefaultValueExpression; - return o != null && this.Type.DoMatch(o.Type, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs index 5fd051285..9f07667ee 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/DirectionExpression.cs @@ -78,11 +78,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax this.FieldDirection = direction; AddChild(expression, Roles.Expression); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - DirectionExpression o = other as DirectionExpression; - return o != null && this.FieldDirection == o.FieldDirection && this.Expression.DoMatch(o.Expression, match); - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs index beece741b..956ec76b7 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/ErrorExpression.cs @@ -42,11 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } } - public string Error { - get; - private set; - } - public ErrorExpression() { } @@ -55,12 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax { AddChild(new Comment(error, CommentType.MultiLine), Roles.Comment); } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - var o = other as ErrorExpression; - return o != null; - } } } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs index 7a78d9739..e6da3ddd6 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/Expressions/IdentifierExpression.cs @@ -64,11 +64,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax public AstNodeCollection TypeArguments { get { return GetChildrenByRole(Roles.TypeArgument); } } - - protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) - { - IdentifierExpression o = other as IdentifierExpression; - return o != null && MatchString(this.Identifier, o.Identifier) && this.TypeArguments.DoMatch(o.TypeArguments, match); - } } } From 19cac08535f18171c17299ac22e723b77acadc6e Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 25 Jul 2025 20:27:29 +0200 Subject: [PATCH 15/15] Get rid of ICSharpCode.Decompiler.Generators.Attributes in favour of EmbeddedAttribute --- Directory.Packages.props | 1 + .../DecompilerAstNodeAttribute.cs | 13 ------- ...de.Decompiler.Generators.Attributes.csproj | 7 ---- .../DecompilerSyntaxTreeGenerator.cs | 34 ++++++++++++++++--- .../GeneratorAttributes.cs | 8 ----- .../ICSharpCode.Decompiler.Generators.csproj | 13 ++----- .../ICSharpCode.Decompiler.csproj | 3 +- ILSpy.sln | 6 ---- 8 files changed, 34 insertions(+), 51 deletions(-) delete mode 100644 ICSharpCode.Decompiler.Generators.Attributes/DecompilerAstNodeAttribute.cs delete mode 100644 ICSharpCode.Decompiler.Generators.Attributes/ICSharpCode.Decompiler.Generators.Attributes.csproj delete mode 100644 ICSharpCode.Decompiler.Generators/GeneratorAttributes.cs 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