Browse Source

Fix #895: Wrong decompilation of references to inner struct in class.

pull/897/head
Siegfried Pammer 8 years ago
parent
commit
9ab7651201
  1. 5
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUsingDeclarations.cs

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

@ -149,18 +149,21 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
astBuilder = CreateAstBuilder(currentContext); astBuilder = CreateAstBuilder(currentContext);
base.VisitNamespaceDeclaration(namespaceDeclaration); base.VisitNamespaceDeclaration(namespaceDeclaration);
} finally { } finally {
astBuilder = CreateAstBuilder(previousContext);
context.Pop(); context.Pop();
} }
} }
public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration) public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
{ {
var currentContext = context.Peek().WithCurrentTypeDefinition(typeDeclaration.GetSymbol() as ITypeDefinition); var previousContext = context.Peek();
var currentContext = previousContext.WithCurrentTypeDefinition(typeDeclaration.GetSymbol() as ITypeDefinition);
context.Push(currentContext); context.Push(currentContext);
try { try {
astBuilder = CreateAstBuilder(currentContext); astBuilder = CreateAstBuilder(currentContext);
base.VisitTypeDeclaration(typeDeclaration); base.VisitTypeDeclaration(typeDeclaration);
} finally { } finally {
astBuilder = CreateAstBuilder(previousContext);
context.Pop(); context.Pop();
} }
} }

Loading…
Cancel
Save