Browse Source

TypeSystemAstBuilder in TransformContext

pull/728/head
Daniel Grunwald 11 years ago
parent
commit
20a7fd1725
  1. 3
      ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs
  2. 5
      ICSharpCode.Decompiler/CSharp/Transforms/TransformContext.cs

3
ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs

@ -103,7 +103,8 @@ namespace ICSharpCode.Decompiler.CSharp
void RunTransforms(AstNode rootNode, ITypeResolveContext decompilationContext) void RunTransforms(AstNode rootNode, ITypeResolveContext decompilationContext)
{ {
var context = new TransformContext(typeSystem, decompilationContext, CancellationToken); var typeSystemAstBuilder = CreateAstBuilder(decompilationContext);
var context = new TransformContext(typeSystem, decompilationContext, typeSystemAstBuilder, CancellationToken);
foreach (var transform in astTransforms) { foreach (var transform in astTransforms) {
CancellationToken.ThrowIfCancellationRequested(); CancellationToken.ThrowIfCancellationRequested();
transform.Run(rootNode, context); transform.Run(rootNode, context);

5
ICSharpCode.Decompiler/CSharp/Transforms/TransformContext.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Threading; using System.Threading;
using ICSharpCode.NRefactory.CSharp.Refactoring;
using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.NRefactory.TypeSystem;
@ -30,6 +31,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
{ {
public readonly DecompilerTypeSystem TypeSystem; public readonly DecompilerTypeSystem TypeSystem;
public readonly CancellationToken CancellationToken; public readonly CancellationToken CancellationToken;
public readonly TypeSystemAstBuilder TypeSystemAstBuilder;
readonly ITypeResolveContext decompilationContext; readonly ITypeResolveContext decompilationContext;
/// <summary> /// <summary>
@ -46,10 +48,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
get { return decompilationContext.CurrentTypeDefinition; } get { return decompilationContext.CurrentTypeDefinition; }
} }
internal TransformContext(DecompilerTypeSystem typeSystem, ITypeResolveContext decompilationContext, CancellationToken cancellationToken) internal TransformContext(DecompilerTypeSystem typeSystem, ITypeResolveContext decompilationContext, TypeSystemAstBuilder typeSystemAstBuilder, CancellationToken cancellationToken)
{ {
this.TypeSystem = typeSystem; this.TypeSystem = typeSystem;
this.decompilationContext = decompilationContext; this.decompilationContext = decompilationContext;
this.TypeSystemAstBuilder = typeSystemAstBuilder;
this.CancellationToken = cancellationToken; this.CancellationToken = cancellationToken;
} }
} }

Loading…
Cancel
Save