diff --git a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs index 9409239efa..6bf75e3509 100644 --- a/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/SequencePointBuilder.cs @@ -164,6 +164,30 @@ public override void VisitBlockStatement(BlockStatement blockStatement) } } + public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) + { + if (!propertyDeclaration.ExpressionBody.IsNull) + { + VisitAsSequencePoint(propertyDeclaration.ExpressionBody); + } + else + { + base.VisitPropertyDeclaration(propertyDeclaration); + } + } + + public override void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) + { + if (!indexerDeclaration.ExpressionBody.IsNull) + { + VisitAsSequencePoint(indexerDeclaration.ExpressionBody); + } + else + { + base.VisitIndexerDeclaration(indexerDeclaration); + } + } + public override void VisitForStatement(ForStatement forStatement) { // Every element of a for-statement is its own sequence point. diff --git a/ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs b/ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs index 5df819e21d..80d177a12e 100644 --- a/ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs +++ b/ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs @@ -218,6 +218,7 @@ void SimplifyPropertyDeclaration(PropertyDeclaration propertyDeclaration) return; propertyDeclaration.Modifiers |= propertyDeclaration.Getter.Modifiers; propertyDeclaration.ExpressionBody = m.Get("expression").Single().Detach(); + propertyDeclaration.CopyAnnotationsFrom(propertyDeclaration.Getter); propertyDeclaration.Getter.Remove(); } @@ -230,6 +231,7 @@ void SimplifyIndexerDeclaration(IndexerDeclaration indexerDeclaration) return; indexerDeclaration.Modifiers |= indexerDeclaration.Getter.Modifiers; indexerDeclaration.ExpressionBody = m.Get("expression").Single().Detach(); + indexerDeclaration.CopyAnnotationsFrom(indexerDeclaration.Getter); indexerDeclaration.Getter.Remove(); } } diff --git a/ICSharpCode.Decompiler/DebugInfo/DebugInfoGenerator.cs b/ICSharpCode.Decompiler/DebugInfo/DebugInfoGenerator.cs index 828107a0ec..8d8eb85575 100644 --- a/ICSharpCode.Decompiler/DebugInfo/DebugInfoGenerator.cs +++ b/ICSharpCode.Decompiler/DebugInfo/DebugInfoGenerator.cs @@ -136,6 +136,30 @@ public override void VisitAnonymousMethodExpression(AnonymousMethodExpression an HandleMethod(anonymousMethodExpression); } + public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration) + { + if (!propertyDeclaration.ExpressionBody.IsNull) + { + HandleMethod(propertyDeclaration.ExpressionBody, propertyDeclaration.Annotation()); + } + else + { + base.VisitPropertyDeclaration(propertyDeclaration); + } + } + + public override void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration) + { + if (!indexerDeclaration.ExpressionBody.IsNull) + { + HandleMethod(indexerDeclaration.ExpressionBody, indexerDeclaration.Annotation()); + } + else + { + base.VisitIndexerDeclaration(indexerDeclaration); + } + } + public override void VisitQueryFromClause(QueryFromClause queryFromClause) { if (queryFromClause.Parent.FirstChild != queryFromClause)