Skip to content

Commit 421865a

Browse files
committed
decompile base & derived types in place
1 parent 0fc0034 commit 421865a

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

ILSpy/TreeNodes/BaseTypesEntryNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal static bool ActivateItem(SharpTreeNode node, ITypeDefinition def)
5858

5959
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
6060
{
61-
language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true));
61+
language.DecompileType(type, output, options);
6262
}
6363

6464
IEntity IMemberTreeNode.Member => type;

ILSpy/TreeNodes/BaseTypesTreeNode.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public override void Decompile(Language language, ITextOutput output, Decompilat
7171
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
7272
foreach (ILSpyTreeNode child in this.Children)
7373
{
74-
child.Decompile(language, output, options);
74+
if (child is IMemberTreeNode { Member: ITypeDefinition childType })
75+
language.WriteCommentLine(output, language.TypeToString(childType, includeNamespace: true));
7576
}
7677
}
7778
}

ILSpy/TreeNodes/DerivedTypesEntryNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public override void ActivateItem(System.Windows.RoutedEventArgs e)
9696

9797
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
9898
{
99-
language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true));
99+
language.DecompileType(type, output, options);
100100
}
101101

102102
IEntity IMemberTreeNode.Member => type;

ILSpy/TreeNodes/DerivedTypesTreeNode.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1717
// DEALINGS IN THE SOFTWARE.
1818

19+
using System;
1920
using System.Collections.Generic;
2021
using System.Linq;
2122
using System.Threading;
23+
using System.Windows.Threading;
2224

2325
using ICSharpCode.Decompiler;
2426
using ICSharpCode.Decompiler.TypeSystem;
@@ -101,7 +103,13 @@ static bool IsSameType(SRM.MetadataReader referenceMetadata, SRM.EntityHandle ty
101103

102104
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
103105
{
104-
threading.Decompile(language, output, options, EnsureLazyChildren);
106+
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
107+
for (int i = 0; i < Children.Count; i++)
108+
{
109+
// LazyChildren are async and will not be ready on first call, avoid foreach.
110+
if (Children[i] is IMemberTreeNode { Member: ITypeDefinition childType })
111+
language.WriteCommentLine(output, language.TypeToString(childType, includeNamespace: true));
112+
}
105113
}
106114
}
107115
}

0 commit comments

Comments
 (0)