diff --git a/Extensions/ILSpy.Decompiler/ICSharpCode.Decompiler b/Extensions/ILSpy.Decompiler/ICSharpCode.Decompiler index 83afd127e2..e356ad4bdc 160000 --- a/Extensions/ILSpy.Decompiler/ICSharpCode.Decompiler +++ b/Extensions/ILSpy.Decompiler/ICSharpCode.Decompiler @@ -1 +1 @@ -Subproject commit 83afd127e2b130be232516265ced838ee055d568 +Subproject commit e356ad4bdcb7a38c6288579c7cea5fb7540ea694 diff --git a/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/CSharp/CSharpDecompiler.cs b/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/CSharp/CSharpDecompiler.cs index 41b3505f30..9c6dfb744e 100644 --- a/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/CSharp/CSharpDecompiler.cs +++ b/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/CSharp/CSharpDecompiler.cs @@ -308,8 +308,7 @@ public override void Decompile(ModuleDef mod, IDecompilerOutput output, Decompil } BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings settings, ModuleDef? currentModule = null, TypeDef? currentType = null, bool isSingleMember = false) { - if (currentModule is null) - currentModule = currentType?.Module; + currentModule ??= currentType?.Module; if (isSingleMember) { settings = settings.Clone(); settings.UsingDeclarations = false; @@ -320,7 +319,7 @@ BuilderState CreateAstBuilder(DecompilationContext ctx, DecompilerSettings setti state.AstBuilder.Context.CancellationToken = ctx.CancellationToken; state.AstBuilder.Context.CurrentType = currentType; state.AstBuilder.Context.Settings = settings; - state.AstBuilder.InitializeTypeSystem(); + state.AstBuilder.InitializeTypeSystem(ctx.GetOrCreate().GetTypeSystem(currentModule, settings)); return state; } diff --git a/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/Mixed/ILWithCSharpDecompiler.cs b/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/Mixed/ILWithCSharpDecompiler.cs index 8fb3e935fe..8185296660 100644 --- a/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/Mixed/ILWithCSharpDecompiler.cs +++ b/Extensions/ILSpy.Decompiler/dnSpy.Decompiler.ILSpy.Core/Mixed/ILWithCSharpDecompiler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; @@ -111,7 +111,8 @@ SourceStatementProvider GetDebugInfo(DecompilationContext ctx, MethodDef method, state.AstBuilder.Context.CurrentType = method.DeclaringType; state.AstBuilder.Context.CancellationToken = ctx.CancellationToken; state.AstBuilder.Context.Settings = settings; - state.AstBuilder.InitializeTypeSystem(); + state.AstBuilder.InitializeTypeSystem(ctx.GetOrCreate() + .GetTypeSystem(state.AstBuilder.Context.CurrentModule, settings)); state.AstBuilder.AddMethod(method); state.AstBuilder.RunTransformations(); state.AstBuilder.GenerateCode(output);