Browse Source

Fix removal of attributes injected by the legacy VB compiler

pull/2874/head
ElektroKill 2 years ago
parent
commit
28e9123634
No known key found for this signature in database
GPG Key ID: 7E3C5C084E40E3EC
  1. 6
      ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs
  2. 4
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

6
ICSharpCode.Decompiler.Tests/TestCases/VBPretty/YieldReturn.cs

@ -1,8 +1,5 @@ @@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
#if LEGACY_VBC
using System.Diagnostics;
#endif
using Microsoft.VisualBasic.CompilerServices;
@ -23,9 +20,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.VBPretty @@ -23,9 +20,6 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.VBPretty
{
private int fieldOnThis;
#if LEGACY_VBC
[DebuggerStepThrough]
#endif
public static IEnumerable<char> YieldChars {
get {
yield return 'a';

4
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -1807,6 +1807,10 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1807,6 +1807,10 @@ namespace ICSharpCode.Decompiler.CSharp
if (function.StateMachineCompiledWithLegacyVisualBasic)
{
RemoveAttribute(entityDecl, KnownAttribute.DebuggerStepThrough);
if (function.Method?.IsAccessor == true && entityDecl.Parent is EntityDeclaration parentDecl)
{
RemoveAttribute(parentDecl, KnownAttribute.DebuggerStepThrough);
}
}
}
if (function.IsAsync)

Loading…
Cancel
Save