Skip to content

Commit

Permalink
Fix icsharpcode#3364: Custom events and indexers can never have an in…
Browse files Browse the repository at this point in the history
…itializer, so do not include them in the output for constructors.
  • Loading branch information
siegfriedpammer committed Jan 9, 2025
1 parent ae77671 commit 126dffe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ILSpy/Languages/CSharpLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ public void Run(AstNode rootNode, TransformContext context)
removedSymbols.Add(pd.GetSymbol());
}
break;
case CustomEventDeclaration ced:
case IndexerDeclaration id:
node.Remove();
removedSymbols.Add(node.GetSymbol());
break;
}
}
if (ctorDecl?.Initializer.ConstructorInitializerType == ConstructorInitializerType.This)
Expand Down Expand Up @@ -291,7 +296,7 @@ static List<EntityHandle> CollectFieldsAndCtors(ITypeDefinition type, bool isSta
}
foreach (var p in type.Properties)
{
if (!p.MetadataToken.IsNil && p.IsStatic == isStatic)
if (!p.MetadataToken.IsNil && p.IsStatic == isStatic && !p.IsIndexer)
members.Add(p.MetadataToken);
}
foreach (var ctor in type.Methods)
Expand Down

0 comments on commit 126dffe

Please sign in to comment.