|
|
|
@ -33,6 +33,8 @@ namespace ICSharpCode.Decompiler.Ast
@@ -33,6 +33,8 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
readonly Stack<AstNode> nodeStack = new Stack<AstNode>(); |
|
|
|
|
int braceLevelWithinType = -1; |
|
|
|
|
bool inDocumentationComment = false; |
|
|
|
|
bool firstUsingDeclaration; |
|
|
|
|
bool lastUsingDeclaration; |
|
|
|
|
|
|
|
|
|
public TextOutputFormatter(ITextOutput output) |
|
|
|
|
{ |
|
|
|
@ -62,6 +64,11 @@ namespace ICSharpCode.Decompiler.Ast
@@ -62,6 +64,11 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (firstUsingDeclaration) { |
|
|
|
|
output.MarkFoldStart(defaultCollapsed: true); |
|
|
|
|
firstUsingDeclaration = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
output.Write(identifier); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -183,6 +190,10 @@ namespace ICSharpCode.Decompiler.Ast
@@ -183,6 +190,10 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
|
|
|
|
|
public void NewLine() |
|
|
|
|
{ |
|
|
|
|
if (lastUsingDeclaration) { |
|
|
|
|
output.MarkFoldEnd(); |
|
|
|
|
lastUsingDeclaration = false; |
|
|
|
|
} |
|
|
|
|
output.WriteLine(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -221,6 +232,15 @@ namespace ICSharpCode.Decompiler.Ast
@@ -221,6 +232,15 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
|
|
|
|
|
public void StartNode(AstNode node) |
|
|
|
|
{ |
|
|
|
|
if (nodeStack.Count == 0) { |
|
|
|
|
if (IsUsingDeclaration(node)) { |
|
|
|
|
firstUsingDeclaration = !IsUsingDeclaration(node.PrevSibling); |
|
|
|
|
lastUsingDeclaration = !IsUsingDeclaration(node.NextSibling); |
|
|
|
|
} else { |
|
|
|
|
firstUsingDeclaration = false; |
|
|
|
|
lastUsingDeclaration = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
nodeStack.Push(node); |
|
|
|
|
startLocations.Push(output.Location); |
|
|
|
|
|
|
|
|
@ -231,6 +251,11 @@ namespace ICSharpCode.Decompiler.Ast
@@ -231,6 +251,11 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private bool IsUsingDeclaration(AstNode node) |
|
|
|
|
{ |
|
|
|
|
return node is UsingDeclaration || node is UsingAliasDeclaration; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void EndNode(AstNode node) |
|
|
|
|
{ |
|
|
|
|
if (nodeStack.Pop() != node) |
|
|
|
|