diff --git a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs b/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs index 6bab20b84..8ae87ae0d 100644 --- a/ICSharpCode.Decompiler.Generators/DecompilerSyntaxTreeGenerator.cs +++ b/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; - // Abstract base nodes are never the dispatch target of DoMatch (concrete subclasses and the - // null-object each emit their own and do not chain to base), so emitting one here is dead code. + // Abstract base nodes are never the dispatch target of DoMatch (concrete subclasses each emit + // their own and do not chain to base), so emitting one here is dead code. if (!targetSymbol.IsAbstract && !targetSymbol.MemberNames.Contains("DoMatch")) { membersToMatch = new(); @@ -324,9 +324,9 @@ internal class DecompilerSyntaxTreeGenerator : IIncrementalGenerator { var slots = slotsArray.ToList(); - // Backing fields and the partial-property bodies. A single slot stores a nullable field and - // substitutes the role's null object when empty (pre-NRT); a collection slot owns a lazily - // created AstNodeCollection bound to this node. A slot re-declared from an inherited contract + // Backing fields and the partial-property bodies. A single slot stores a nullable backing + // field (returned null-forgiving for a required child, nullable for an optional one); a + // 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. foreach (var (roleExpr, isCollection, name, type, elementType, isOverride, isNullable, kindName, isPartial) in slots) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs index ddcf00c8c..f027b9356 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNode.cs +++ b/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 // 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 - // (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; @@ -487,9 +487,9 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax SetChildByRoleUntyped(kind, child); } - // Sets the single slot matching the role (used by the non-generic mutation API). Symmetric with - // GetChildByRole, which returns null for a role this node does not declare a slot for: - // a node has no child of a role it has no slot for, so writing one is a no-op. + // Sets the single slot matching the kind (used by the non-generic mutation API). Unlike + // GetChildByRole, which returns null when this node declares no slot of that kind, writing a + // child to a kind the node has no slot for throws. internal void SetChildByRoleUntyped(SlotKind kind, AstNode? child) { int count = GetChildCount(); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs b/ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs index 72031cccd..8364a695c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/AstNodeCollection.cs @@ -240,7 +240,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// 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. /// public T FirstOrNullObject(Func? predicate = null) { @@ -252,7 +252,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// 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. /// public T LastOrNullObject(Func? predicate = null) { diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs index 2c68d2e00..2bbf3e57c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/EventDeclaration.cs @@ -89,7 +89,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// 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. /// [Slot("PrivateImplementationType")] public partial AstType? PrivateImplementationType { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs index f32636c92..ed883314a 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/IndexerDeclaration.cs @@ -50,16 +50,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return SymbolKind.Indexer; } } - /// - /// Gets/Sets the type reference of the interface that is explicitly implemented. - /// Null node if this member is not an explicit interface implementation. - /// [Slot("Attribute")] public override partial AstNodeCollection Attributes { get; } [Slot("Type")] public override partial AstType ReturnType { get; set; } + /// + /// Gets/Sets the type reference of the interface that is explicitly implemented. + /// Null if this member is not an explicit interface implementation. + /// [Slot("PrivateImplementationType")] public partial AstType? PrivateImplementationType { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs index 7d6dcfc6e..a7237d9c2 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/MethodDeclaration.cs @@ -50,7 +50,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax /// /// 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. /// [Slot("PrivateImplementationType")] public partial AstType? PrivateImplementationType { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs index 09036e6e5..2ded5448d 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/OperatorDeclaration.cs @@ -142,16 +142,16 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return SymbolKind.Operator; } } - /// - /// Gets/Sets the type reference of the interface that is explicitly implemented. - /// Null node if this member is not an explicit interface implementation. - /// [Slot("Attribute")] public override partial AstNodeCollection Attributes { get; } [Slot("Type")] public override partial AstType ReturnType { get; set; } + /// + /// Gets/Sets the type reference of the interface that is explicitly implemented. + /// Null if this member is not an explicit interface implementation. + /// [Slot("PrivateImplementationType")] public partial AstType? PrivateImplementationType { get; set; } diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs index 7a6a6a162..733050e35 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeMembers/PropertyDeclaration.cs @@ -46,10 +46,6 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax get { return SymbolKind.Property; } } - /// - /// Gets/Sets the type reference of the interface that is explicitly implemented. - /// Null node if this member is not an explicit interface implementation. - /// [Slot("Attribute")] public override partial AstNodeCollection Attributes { get; } @@ -59,6 +55,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax [Slot("Identifier")] public override partial Identifier NameToken { get; set; } + /// + /// Gets/Sets the type reference of the interface that is explicitly implemented. + /// Null if this member is not an explicit interface implementation. + /// [Slot("PrivateImplementationType")] public partial AstType? PrivateImplementationType { get; set; }