Browse Source

Delete the NodeType enum and other dead node members

NodeType was NRefactory's coarse node category, but only three reads remained
here: two checks now expressed as "is not Trivia" and one debug assert for the
pattern category. Remove the enum, the abstract property, every per-node
override, and the generator's emission, preserving the pattern-placeholder case
through an IPatternPlaceholder marker interface the output-visitor assert
checks. Also remove the unused PrimitiveExpression.AdvanceLocation helper.
Assisted-by: Claude:claude-opus-4-8:Claude Code
pull/3807/head
Siegfried Pammer 3 weeks ago committed by Siegfried Pammer
parent
commit
fe41cfeca5
  1. 8
      ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  3. 4
      ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertMissingTokensDecorator.cs
  4. 4
      ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs
  5. 3
      ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs
  6. 5
      ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs
  7. 4
      ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs
  8. 5
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs
  9. 1
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs
  10. 33
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs
  11. 7
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs
  12. 1
      ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs
  13. 5
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs
  14. 5
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs
  15. 5
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs
  16. 3
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs
  17. 3
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs
  18. 5
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs
  19. 6
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs
  20. 5
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs
  21. 3
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs
  22. 4
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs
  23. 6
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs
  24. 6
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs
  25. 5
      ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs
  26. 54
      ICSharpCode.Decompiler/CSharp/Syntax/NodeType.cs
  27. 28
      ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IPatternPlaceholder.cs
  28. 3
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs
  29. 12
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs
  30. 6
      ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs
  31. 6
      ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs
  32. 1
      ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs
  33. 3
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs
  34. 6
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs
  35. 4
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs
  36. 5
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs
  37. 2
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs
  38. 5
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs
  39. 1
      ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs
  40. 2
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

8
ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs

@ -174,8 +174,6 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -174,8 +174,6 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
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)
@ -228,7 +226,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -228,7 +226,7 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
return pattern != null ? new PatternPlaceholder(pattern) : null{forgive};
}}
sealed class PatternPlaceholder : {source.NodeName}, INode
sealed class PatternPlaceholder : {source.NodeName}, INode, PatternMatching.IPatternPlaceholder
{{
readonly PatternMatching.Pattern child;
@ -237,10 +235,6 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator @@ -237,10 +235,6 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
this.child = child;
}}
public override NodeType NodeType {{
get {{ return NodeType.Pattern; }}
}}
public override void AcceptVisitor(IAstVisitor visitor)
{{
visitor.VisitPatternPlaceholder(this, child);

2
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -73,7 +73,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
// Ensure that nodes are visited in the proper nested order.
// Jumps to different subtrees are allowed only for the child of a placeholder node.
Debug.Assert(containerStack.Count == 0 || node.Parent == containerStack.Peek() || containerStack.Peek().NodeType == NodeType.Pattern);
Debug.Assert(containerStack.Count == 0 || node.Parent == containerStack.Peek() || containerStack.Peek() is IPatternPlaceholder);
containerStack.Push(node);
writer.StartNode(node);
foreach (var trivia in node.LeadingTrivia)

4
ICSharpCode.Decompiler/CSharp/OutputVisitor/InsertMissingTokensDecorator.cs

@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
// ignore whitespace: these don't need to be processed.
// StartNode/EndNode is only called for them to support folding of comments.
if (node.NodeType != NodeType.Whitespace)
if (node is not Trivia)
{
currentList.Add(node);
nodes.Push(currentList);
@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -81,7 +81,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
{
// ignore whitespace: these don't need to be processed.
// StartNode/EndNode is only called for them to support folding of comments.
if (node.NodeType != NodeType.Whitespace)
if (node is not Trivia)
{
// A node that printed no tokens of its own collapses to a zero-width span here.
if (nodesAwaitingStart.Remove(node))

4
ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs

@ -57,10 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -57,10 +57,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
const uint roleIndexMask = (1u << Role.RoleIndexBits) - 1;
protected const int AstNodeFlagsUsedBits = Role.RoleIndexBits;
public abstract NodeType NodeType {
get;
}
public virtual bool IsNull {
get {
return false;

3
ICSharpCode.Decompiler/CSharp/Syntax/AstType.cs

@ -29,9 +29,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -29,9 +29,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)]
public abstract partial class AstType : AstNode
{
public override NodeType NodeType {
get { return NodeType.TypeReference; }
}
public new AstType Clone()
{

5
ICSharpCode.Decompiler/CSharp/Syntax/ComposedType.cs

@ -137,11 +137,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -137,11 +137,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class ArraySpecifier : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public ArraySpecifier()
{

4
ICSharpCode.Decompiler/CSharp/Syntax/DocumentationReference.cs

@ -75,10 +75,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -75,10 +75,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
}
}
public override NodeType NodeType {
get { return NodeType.Unknown; }
}
/// <summary>
/// Gets/Sets the declaring type.
/// </summary>

5
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/Expression.cs

@ -30,11 +30,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -30,11 +30,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)]
public abstract partial class Expression : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Expression;
}
}
public new Expression Clone()
{

1
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/InterpolatedStringExpression.cs

@ -38,7 +38,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -38,7 +38,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
public new static readonly Role<InterpolatedStringContent> Role = new Role<InterpolatedStringContent>("InterpolatedStringContent", Syntax.InterpolatedStringContent.Null);
public override NodeType NodeType => NodeType.Unknown;
}
/// <summary>

33
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/PrimitiveExpression.cs

@ -100,39 +100,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -100,39 +100,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
this.format = format;
}
unsafe static TextLocation AdvanceLocation(TextLocation startLocation, string str)
{
int line = startLocation.Line;
int col = startLocation.Column;
fixed (char* start = str)
{
char* p = start;
char* endPtr = start + str.Length;
while (p < endPtr)
{
var nl = NewLine.GetDelimiterLength(*p, () => {
char* nextp = p + 1;
if (nextp < endPtr)
return *nextp;
return '\0';
});
if (nl > 0)
{
line++;
col = 1;
if (nl == 2)
p++;
}
else
{
col++;
}
p++;
}
}
return new TextLocation(line, col);
}
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match)
{
PrimitiveExpression o = other as PrimitiveExpression;

7
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/QueryExpression.cs

@ -32,9 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,9 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public abstract class QueryClause : AstNode
{
public override NodeType NodeType {
get { return NodeType.QueryClause; }
}
}
/// <summary>
@ -229,10 +226,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -229,10 +226,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public readonly static TokenRole AscendingKeywordRole = new TokenRole("ascending");
public readonly static TokenRole DescendingKeywordRole = new TokenRole("descending");
public override NodeType NodeType {
get { return NodeType.Unknown; }
}
[Slot("Roles.Expression")]
public partial Expression Expression { get; set; }

1
ICSharpCode.Decompiler/CSharp/Syntax/Expressions/SwitchExpression.cs

@ -50,6 +50,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -50,6 +50,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("BodyRole")]
public partial Expression Body { get; set; }
public override NodeType NodeType => NodeType.Unknown;
}
}

5
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Attribute.cs

@ -34,11 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -34,11 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class Attribute : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
[Slot("Roles.Type")]
public partial AstType Type { get; set; }

5
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/AttributeSection.cs

@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false, hasPatternPlaceholder: true)]
public partial class AttributeSection : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public string AttributeTarget {
get {

5
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Comment.cs

@ -56,11 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -56,11 +56,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class Comment : Trivia
{
public override NodeType NodeType {
get {
return NodeType.Whitespace;
}
}
CommentType commentType;

3
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/Constraint.cs

@ -33,9 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -33,9 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true)]
public partial class Constraint : AstNode
{
public override NodeType NodeType {
get { return NodeType.Unknown; }
}
[Slot("Roles.ConstraintTypeParameter")]
public partial SimpleType TypeParameter { get; set; }

3
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/DelegateDeclaration.cs

@ -34,9 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -34,9 +34,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class DelegateDeclaration : EntityDeclaration
{
public override NodeType NodeType {
get { return NodeType.TypeDeclaration; }
}
public override SymbolKind SymbolKind {
get { return SymbolKind.TypeDefinition; }

5
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/ExternAliasDeclaration.cs

@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class ExternAliasDeclaration : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public string Name {
get {

6
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs

@ -42,12 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -42,12 +42,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly Role<AstNode> MemberRole = SyntaxTree.MemberRole;
public static readonly Role<AstType> NamespaceNameRole = new Role<AstType>("NamespaceName", AstType.Null);
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public bool IsFileScoped { get; set; }
[Slot("NamespaceNameRole")]

5
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/PreProcessorDirective.cs

@ -106,11 +106,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -106,11 +106,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class PreProcessorDirective : Trivia
{
public override NodeType NodeType {
get {
return NodeType.Whitespace;
}
}
public PreProcessorDirectiveType Type {
get;

3
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeDeclaration.cs

@ -50,9 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -50,9 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class TypeDeclaration : EntityDeclaration
{
public override NodeType NodeType {
get { return NodeType.TypeDeclaration; }
}
public override SymbolKind SymbolKind {
get { return SymbolKind.TypeDefinition; }

4
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/TypeParameterDeclaration.cs

@ -33,10 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -33,10 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole OutVarianceKeywordRole = new TokenRole("out");
public static readonly TokenRole InVarianceKeywordRole = new TokenRole("in");
public override NodeType NodeType {
get { return NodeType.Unknown; }
}
[Slot("AttributeRole")]
public partial AstNodeCollection<AttributeSection> Attributes { get; }

6
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingAliasDeclaration.cs

@ -36,12 +36,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -36,12 +36,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly Role<Identifier> AliasRole = new Role<Identifier>("Alias", Identifier.Null);
public static readonly Role<AstType> ImportRole = UsingDeclaration.ImportRole;
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public string Alias {
get {
return AliasToken.Name;

6
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/UsingDeclaration.cs

@ -43,12 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -43,12 +43,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole UsingKeywordRole = new TokenRole("using");
public static readonly Role<AstType> ImportRole = new Role<AstType>("Import", AstType.Null);
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
[Slot("ImportRole")]
public partial AstType Import { get; set; }

5
ICSharpCode.Decompiler/CSharp/Syntax/Identifier.cs

@ -40,11 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -40,11 +40,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true)]
public partial class Identifier : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Token;
}
}
string name;
public string Name {

54
ICSharpCode.Decompiler/CSharp/Syntax/NodeType.cs

@ -1,54 +0,0 @@ @@ -1,54 +0,0 @@
//
// NodeType.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
//
// 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
{
public enum NodeType
{
Unknown,
/// <summary>
/// AstType
/// </summary>
TypeReference,
/// <summary>
/// Type or delegate declaration
/// </summary>
TypeDeclaration,
Member,
Statement,
Expression,
Token,
QueryClause,
/// <summary>
/// Comment or whitespace or pre-processor directive
/// </summary>
Whitespace,
/// <summary>
/// Placeholder for a pattern
/// </summary>
Pattern
}
}

28
ICSharpCode.Decompiler/CSharp/Syntax/PatternMatching/IPatternPlaceholder.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// Copyright (c) 2011-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.PatternMatching
{
/// <summary>
/// Marker for the generated node that wraps a <see cref="Pattern"/> so it can occupy an AST slot
/// (one per node type, each a sealed subclass of its own node, so they share no common node base).
/// </summary>
public interface IPatternPlaceholder
{
}
}

3
ICSharpCode.Decompiler/CSharp/Syntax/Statements/Statement.cs

@ -42,8 +42,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -42,8 +42,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
return (Statement)base.ReplaceWith(node => replaceFunction((Statement)node));
}
public override NodeType NodeType {
get { return NodeType.Statement; }
}
}
}

12
ICSharpCode.Decompiler/CSharp/Syntax/Statements/SwitchStatement.cs

@ -50,12 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -50,12 +50,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
public static readonly Role<CaseLabel> CaseLabelRole = new Role<CaseLabel>("CaseLabel", null);
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
[Slot("CaseLabelRole")]
public partial AstNodeCollection<CaseLabel> CaseLabels { get; }
@ -72,12 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -72,12 +66,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole CaseKeywordRole = new TokenRole("case");
public static readonly TokenRole DefaultKeywordRole = new TokenRole("default");
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
/// <summary>
/// Gets or sets the expression. The expression can be null - if the expression is null, it's the default switch section.
/// </summary>

6
ICSharpCode.Decompiler/CSharp/Syntax/Statements/TryCatchStatement.cs

@ -60,12 +60,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -60,12 +60,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole CondLPar = new TokenRole("(");
public static readonly TokenRole CondRPar = new TokenRole(")");
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
[Slot("Roles.Type")]
public partial AstType Type { get; set; }

6
ICSharpCode.Decompiler/CSharp/Syntax/SyntaxTree.cs

@ -38,12 +38,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -38,12 +38,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
public static readonly Role<AstNode> MemberRole = new Role<AstNode>("Member", AstNode.Null);
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
[Slot("MemberRole")]
public partial AstNodeCollection<AstNode> Members { get; }

1
ICSharpCode.Decompiler/CSharp/Syntax/TupleAstType.cs

@ -49,6 +49,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -49,6 +49,5 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Roles.Identifier")]
public partial Identifier NameToken { get; set; }
public override NodeType NodeType => NodeType.Unknown;
}
}

3
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/Accessor.cs

@ -46,9 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -46,9 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true)]
public partial class Accessor : EntityDeclaration
{
public override NodeType NodeType {
get { return NodeType.Unknown; }
}
public override SymbolKind SymbolKind {
get { return SymbolKind.Method; }

6
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ConstructorDeclaration.cs

@ -74,12 +74,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -74,12 +74,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole BaseKeywordRole = new TokenRole("base");
public static readonly TokenRole ThisKeywordRole = new TokenRole("this");
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public ConstructorInitializerType ConstructorInitializerType {
get;
set;

4
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EntityDeclaration.cs

@ -33,10 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -33,10 +33,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole ModifierRole = new TokenRole("modifier");
public static readonly Role<AstType> PrivateImplementationTypeRole = new Role<AstType>("PrivateImplementationType", AstType.Null);
public override NodeType NodeType {
get { return NodeType.Member; }
}
public abstract SymbolKind SymbolKind { get; }
public virtual AstNodeCollection<AttributeSection> Attributes {

5
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/FixedVariableInitializer.cs

@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: false)]
public partial class FixedVariableInitializer : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public FixedVariableInitializer()
{

2
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/ParameterDeclaration.cs

@ -46,8 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -46,8 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
public static readonly TokenRole InModifierRole = new TokenRole("in");
public static readonly TokenRole ParamsModifierRole = new TokenRole("params");
public override NodeType NodeType => NodeType.Unknown;
[Slot("AttributeRole")]
public partial AstNodeCollection<AttributeSection> Attributes { get; }

5
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/VariableInitializer.cs

@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -32,11 +32,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true, hasPatternPlaceholder: true)]
public partial class VariableInitializer : AstNode
{
public override NodeType NodeType {
get {
return NodeType.Unknown;
}
}
public VariableInitializer()
{

1
ICSharpCode.Decompiler/CSharp/Syntax/VariableDesignation.cs

@ -21,7 +21,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax @@ -21,7 +21,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[DecompilerAstNode(hasNullNode: true)]
public abstract partial class VariableDesignation : AstNode
{
public override NodeType NodeType => NodeType.Unknown;
}
/// <summary>

2
ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj

@ -251,13 +251,13 @@ @@ -251,13 +251,13 @@
<Compile Include="CSharp\Syntax\PatternMatching\IdentifierExpressionBackreference.cs" />
<Compile Include="CSharp\Syntax\MemberType.cs" />
<Compile Include="CSharp\Syntax\Modifiers.cs" />
<Compile Include="CSharp\Syntax\NodeType.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\AnyNode.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\AnyNodeOrNull.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\Backreference.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\BacktrackingInfo.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\Choice.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\INode.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\IPatternPlaceholder.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\Match.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\NamedNode.cs" />
<Compile Include="CSharp\Syntax\PatternMatching\OptionalNode.cs" />

Loading…
Cancel
Save