Browse Source

Refresh generated-code comments after the null-object removal

pull/3807/head
Siegfried Pammer 3 weeks ago committed by Siegfried Pammer
parent
commit
a42febd3c4
  1. 10
      ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs
  2. 8
      ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs
  3. 4
      ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs
  4. 2
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs
  5. 8
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs
  6. 2
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs
  7. 8
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs
  8. 8
      ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs

10
ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs

@ -58,8 +58,8 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
List<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny, bool Nullable)>? membersToMatch = null; List<(string Member, string TypeName, bool RecursiveMatch, bool MatchAny, bool Nullable)>? membersToMatch = null;
// Abstract base nodes are never the dispatch target of DoMatch (concrete subclasses and the // Abstract base nodes are never the dispatch target of DoMatch (concrete subclasses each emit
// null-object each emit their own and do not chain to base), so emitting one here is dead code. // their own and do not chain to base), so emitting one here is dead code.
if (!targetSymbol.IsAbstract && !targetSymbol.MemberNames.Contains("DoMatch")) if (!targetSymbol.IsAbstract && !targetSymbol.MemberNames.Contains("DoMatch"))
{ {
membersToMatch = new(); membersToMatch = new();
@ -324,9 +324,9 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator
{ {
var slots = slotsArray.ToList(); var slots = slotsArray.ToList();
// Backing fields and the partial-property bodies. A single slot stores a nullable field and // Backing fields and the partial-property bodies. A single slot stores a nullable backing
// substitutes the role's null object when empty (pre-NRT); a collection slot owns a lazily // field (returned null-forgiving for a required child, nullable for an optional one); a
// created AstNodeCollection bound to this node. A slot re-declared from an inherited contract // collection slot owns a lazily created AstNodeCollection bound to this node. A slot re-declared from an inherited contract
// member (Part I.3 flatten) is an override. // member (Part I.3 flatten) is an override.
foreach (var (roleExpr, isCollection, name, type, elementType, isOverride, isNullable, kindName, isPartial) in slots) foreach (var (roleExpr, isCollection, name, type, elementType, isOverride, isNullable, kindName, isPartial) in slots)
{ {

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

@ -343,7 +343,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
// A single slot occupies exactly one index (even when empty, where GetChild returns null); a // A single slot occupies exactly one index (even when empty, where GetChild returns null); a
// collection slot occupies a contiguous run of its current length. The generator emits these // collection slot occupies a contiguous run of its current length. The generator emits these
// four members per node from its [Slot] partial-property declarations; nodes without children // four members per node from its [Slot] partial-property declarations; nodes without children
// (and the null/placeholder nodes) keep the zero-child defaults below. // (and the placeholder nodes) keep the zero-child defaults below.
internal virtual int GetChildCount() => 0; internal virtual int GetChildCount() => 0;
@ -487,9 +487,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
SetChildByRoleUntyped(kind, child); SetChildByRoleUntyped(kind, child);
} }
// Sets the single slot matching the role (used by the non-generic mutation API). Symmetric with // Sets the single slot matching the kind (used by the non-generic mutation API). Unlike
// GetChildByRole, which returns null for a role this node does not declare a slot for: // GetChildByRole, which returns null when this node declares no slot of that kind, writing a
// a node has no child of a role it has no slot for, so writing one is a no-op. // child to a kind the node has no slot for throws.
internal void SetChildByRoleUntyped(SlotKind kind, AstNode? child) internal void SetChildByRoleUntyped(SlotKind kind, AstNode? child)
{ {
int count = GetChildCount(); int count = GetChildCount();

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

@ -240,7 +240,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// <summary> /// <summary>
/// Returns the first element for which the predicate returns true, /// Returns the first element for which the predicate returns true,
/// or the null node (AstNode with IsNull=true) if no such object is found. /// or null if no such object is found.
/// </summary> /// </summary>
public T FirstOrNullObject(Func<T, bool>? predicate = null) public T FirstOrNullObject(Func<T, bool>? predicate = null)
{ {
@ -252,7 +252,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// <summary> /// <summary>
/// Returns the last element for which the predicate returns true, /// Returns the last element for which the predicate returns true,
/// or the null node (AstNode with IsNull=true) if no such object is found. /// or null if no such object is found.
/// </summary> /// </summary>
public T LastOrNullObject(Func<T, bool>? predicate = null) public T LastOrNullObject(Func<T, bool>? predicate = null)
{ {

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

@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// <summary> /// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented. /// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null node if this member is not an explicit interface implementation. /// Null if this member is not an explicit interface implementation.
/// </summary> /// </summary>
[Slot("PrivateImplementationType")] [Slot("PrivateImplementationType")]
public partial AstType? PrivateImplementationType { get; set; } public partial AstType? PrivateImplementationType { get; set; }

8
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs

@ -50,16 +50,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
get { return SymbolKind.Indexer; } get { return SymbolKind.Indexer; }
} }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null node if this member is not an explicit interface implementation.
/// </summary>
[Slot("Attribute")] [Slot("Attribute")]
public override partial AstNodeCollection<AttributeSection> Attributes { get; } public override partial AstNodeCollection<AttributeSection> Attributes { get; }
[Slot("Type")] [Slot("Type")]
public override partial AstType ReturnType { get; set; } public override partial AstType ReturnType { get; set; }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null if this member is not an explicit interface implementation.
/// </summary>
[Slot("PrivateImplementationType")] [Slot("PrivateImplementationType")]
public partial AstType? PrivateImplementationType { get; set; } public partial AstType? PrivateImplementationType { get; set; }

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

@ -50,7 +50,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
/// <summary> /// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented. /// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null node if this member is not an explicit interface implementation. /// Null if this member is not an explicit interface implementation.
/// </summary> /// </summary>
[Slot("PrivateImplementationType")] [Slot("PrivateImplementationType")]
public partial AstType? PrivateImplementationType { get; set; } public partial AstType? PrivateImplementationType { get; set; }

8
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs

@ -142,16 +142,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
get { return SymbolKind.Operator; } get { return SymbolKind.Operator; }
} }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null node if this member is not an explicit interface implementation.
/// </summary>
[Slot("Attribute")] [Slot("Attribute")]
public override partial AstNodeCollection<AttributeSection> Attributes { get; } public override partial AstNodeCollection<AttributeSection> Attributes { get; }
[Slot("Type")] [Slot("Type")]
public override partial AstType ReturnType { get; set; } public override partial AstType ReturnType { get; set; }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null if this member is not an explicit interface implementation.
/// </summary>
[Slot("PrivateImplementationType")] [Slot("PrivateImplementationType")]
public partial AstType? PrivateImplementationType { get; set; } public partial AstType? PrivateImplementationType { get; set; }

8
ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs

@ -46,10 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
get { return SymbolKind.Property; } get { return SymbolKind.Property; }
} }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null node if this member is not an explicit interface implementation.
/// </summary>
[Slot("Attribute")] [Slot("Attribute")]
public override partial AstNodeCollection<AttributeSection> Attributes { get; } public override partial AstNodeCollection<AttributeSection> Attributes { get; }
@ -59,6 +55,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
[Slot("Identifier")] [Slot("Identifier")]
public override partial Identifier NameToken { get; set; } public override partial Identifier NameToken { get; set; }
/// <summary>
/// Gets/Sets the type reference of the interface that is explicitly implemented.
/// Null if this member is not an explicit interface implementation.
/// </summary>
[Slot("PrivateImplementationType")] [Slot("PrivateImplementationType")]
public partial AstType? PrivateImplementationType { get; set; } public partial AstType? PrivateImplementationType { get; set; }

Loading…
Cancel
Save