Browse Source

Move UsingScope and CSharpTypeResolveContext into the type system

Both types are consumed well outside the C# output layer - DecompileRun
carries the using scope, and the IL transforms build a resolve context from
it - so living in ICSharpCode.Decompiler.CSharp.TypeSystem misrepresented
where they belong and forced a C#-specific namespace import on every
consumer.

Assisted-by: Claude:claude-opus-5[1m]:Claude Code
pull/4006/head
Siegfried Pammer 1 month ago
parent
commit
48fcf0313e
  1. 2
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  2. 1
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  3. 1
      ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
  4. 1
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
  5. 2
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceExtensionMethods.cs
  6. 1
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUsingDeclarations.cs
  7. 4
      ICSharpCode.Decompiler/DecompileRun.cs
  8. 1
      ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs
  9. 2
      ICSharpCode.Decompiler/IL/Transforms/IILTransform.cs
  10. 4
      ICSharpCode.Decompiler/TypeSystem/Implementation/CSharpTypeResolveContext.cs
  11. 4
      ICSharpCode.Decompiler/TypeSystem/UsingScope.cs

2
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -32,7 +32,6 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor; @@ -32,7 +32,6 @@ using ICSharpCode.Decompiler.CSharp.OutputVisitor;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.CSharp.Transforms;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.DebugSteps;
using ICSharpCode.Decompiler.DebugInfo;
using ICSharpCode.Decompiler.Disassembler;
@ -44,6 +43,7 @@ using ICSharpCode.Decompiler.Instrumentation; @@ -44,6 +43,7 @@ using ICSharpCode.Decompiler.Instrumentation;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.Decompiler.Util;
using SRM = System.Reflection.Metadata;

1
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -28,7 +28,6 @@ using System.Threading; @@ -28,7 +28,6 @@ using System.Threading;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.CSharp.Transforms;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.IL;
using ICSharpCode.Decompiler.IL.Transforms;
using ICSharpCode.Decompiler.Semantics;

1
ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs

@ -23,7 +23,6 @@ using System.Diagnostics; @@ -23,7 +23,6 @@ using System.Diagnostics;
using System.Linq;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;

1
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -27,7 +27,6 @@ using System.Reflection.Metadata.Ecma335; @@ -27,7 +27,6 @@ using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;

2
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceExtensionMethods.cs

@ -25,9 +25,9 @@ using System.Linq; @@ -25,9 +25,9 @@ using System.Linq;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.Decompiler.Util;
namespace ICSharpCode.Decompiler.CSharp.Transforms

1
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUsingDeclarations.cs

@ -29,7 +29,6 @@ using ICSharpCode.Decompiler.CSharp.Syntax; @@ -29,7 +29,6 @@ using ICSharpCode.Decompiler.CSharp.Syntax;
#if STEP
using ICSharpCode.Decompiler.CSharp.Syntax.PatternMatching;
#endif
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.IL;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;

4
ICSharpCode.Decompiler/DecompileRun.cs

@ -46,9 +46,9 @@ namespace ICSharpCode.Decompiler @@ -46,9 +46,9 @@ namespace ICSharpCode.Decompiler
public Dictionary<ITypeDefinition, bool> TypeHierarchyIsKnown { get; } = new();
public CSharp.TypeSystem.UsingScope UsingScope { get; }
public UsingScope UsingScope { get; }
public DecompileRun(DecompilerSettings settings, CSharp.TypeSystem.UsingScope usingScope)
public DecompileRun(DecompilerSettings settings, UsingScope usingScope)
{
this.Settings = settings ?? throw new ArgumentNullException(nameof(settings));
this.UsingScope = usingScope ?? throw new ArgumentNullException(nameof(usingScope));

1
ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs

@ -29,7 +29,6 @@ using Humanizer.Inflections; @@ -29,7 +29,6 @@ using Humanizer.Inflections;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.CSharp.OutputVisitor;
using ICSharpCode.Decompiler.CSharp.Transforms;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.Decompiler.Util;

2
ICSharpCode.Decompiler/IL/Transforms/IILTransform.cs

@ -24,10 +24,10 @@ using System.Diagnostics; @@ -24,10 +24,10 @@ using System.Diagnostics;
using System.Threading;
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.DebugSteps;
using ICSharpCode.Decompiler.DebugInfo;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.Decompiler.Util;
namespace ICSharpCode.Decompiler.IL.Transforms

4
ICSharpCode.Decompiler/CSharp/TypeSystem/CSharpTypeResolveContext.cs → ICSharpCode.Decompiler/TypeSystem/Implementation/CSharpTypeResolveContext.cs

@ -18,9 +18,7 @@ @@ -18,9 +18,7 @@
using System;
using ICSharpCode.Decompiler.TypeSystem;
namespace ICSharpCode.Decompiler.CSharp.TypeSystem
namespace ICSharpCode.Decompiler.TypeSystem.Implementation
{
public sealed class CSharpTypeResolveContext : ITypeResolveContext
{

4
ICSharpCode.Decompiler/CSharp/TypeSystem/UsingScope.cs → ICSharpCode.Decompiler/TypeSystem/UsingScope.cs

@ -23,12 +23,12 @@ using System.Collections.Immutable; @@ -23,12 +23,12 @@ using System.Collections.Immutable;
using ICSharpCode.Decompiler.CSharp.Syntax;
using ICSharpCode.Decompiler.Semantics;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.Decompiler.Util;
#nullable enable
namespace ICSharpCode.Decompiler.CSharp.TypeSystem
namespace ICSharpCode.Decompiler.TypeSystem
{
/// <summary>
/// Represents a scope that contains "using" statements.
Loading…
Cancel
Save