Skip to content

Commit

Permalink
decompile base & derived types in place
Browse files Browse the repository at this point in the history
  • Loading branch information
miloush committed Sep 9, 2023
1 parent 0fc0034 commit 1215c5e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ILSpy/TreeNodes/BaseTypesEntryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal static bool ActivateItem(SharpTreeNode node, ITypeDefinition def)

public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true));
language.DecompileType(type, output, options);
}

IEntity IMemberTreeNode.Member => type;
Expand Down
3 changes: 2 additions & 1 deletion ILSpy/TreeNodes/BaseTypesTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public override void Decompile(Language language, ITextOutput output, Decompilat
App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureLazyChildren));
foreach (ILSpyTreeNode child in this.Children)
{
child.Decompile(language, output, options);
if (child is IMemberTreeNode { Member: ITypeDefinition childType })
language.WriteCommentLine(output, language.TypeToString(childType, includeNamespace: true));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ILSpy/TreeNodes/DerivedTypesEntryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override void ActivateItem(System.Windows.RoutedEventArgs e)

public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
language.WriteCommentLine(output, language.TypeToString(type, includeNamespace: true));
language.DecompileType(type, output, options);
}

IEntity IMemberTreeNode.Member => type;
Expand Down
10 changes: 9 additions & 1 deletion ILSpy/TreeNodes/DerivedTypesTreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Threading;

using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.TypeSystem;
Expand Down Expand Up @@ -101,7 +103,13 @@ static bool IsSameType(SRM.MetadataReader referenceMetadata, SRM.EntityHandle ty

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

0 comments on commit 1215c5e

Please sign in to comment.