Browse Source

remove isLastLine from interface - use stack instead; fix null reference if resolve of TypeDefinition fails

pull/172/merge
Siegfried Pammer 14 years ago
parent
commit
e9eca059d5
  1. 2
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  2. 3
      ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs
  3. 2
      NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/IOutputFormatter.cs
  4. 4
      NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs
  5. 2
      NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/TextWriterOutputFormatter.cs

2
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -428,12 +428,12 @@ namespace ICSharpCode.Decompiler.Ast @@ -428,12 +428,12 @@ namespace ICSharpCode.Decompiler.Ast
} else {
astType = new SimpleType(name);
if (!type.HasGenericParameters) {
// Look for generic type parameters defined in TypeDefinition
// allows us to display angle brackets in unbound type names
// e.g. typeof(List<>)
TypeDefinition resolvedType = type.Resolve();
if (!type.HasGenericParameters && resolvedType != null) {
for (int i = 0; i < resolvedType.GenericParameters.Count; i++) {
((SimpleType)astType).TypeArguments.Add(new SimpleType(""));
}

3
ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -103,7 +103,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -103,7 +103,7 @@ namespace ICSharpCode.Decompiler.Ast
output.WriteLine();
}
public void WriteComment(CommentType commentType, string content, bool isLastLine = false)
public void WriteComment(CommentType commentType, string content)
{
switch (commentType) {
case CommentType.SingleLine:
@ -121,6 +121,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -121,6 +121,7 @@ namespace ICSharpCode.Decompiler.Ast
output.Write("///");
output.Write(content);
inDocumentationComment = true;
bool isLastLine = !(nodeStack.Peek().NextSibling is Comment);
if (isLastLine) {
inDocumentationComment = false;
output.MarkFoldEnd();

2
NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/IOutputFormatter.cs

@ -39,6 +39,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -39,6 +39,6 @@ namespace ICSharpCode.NRefactory.CSharp
void NewLine();
void WriteComment(CommentType commentType, string content, bool isLastLine = false);
void WriteComment(CommentType commentType, string content);
}
}

4
NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/OutputVisitor.cs

@ -2147,9 +2147,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -2147,9 +2147,7 @@ namespace ICSharpCode.NRefactory.CSharp
// "1.0 / /*comment*/a", then we need to insert a space in front of the comment.
formatter.Space();
}
bool isContinuing = (comment.NextSibling is Comment && ((Comment)comment.NextSibling).CommentType == comment.CommentType);
formatter.WriteComment(comment.CommentType, comment.Content, !isContinuing);
formatter.WriteComment(comment.CommentType, comment.Content);
lastWritten = LastWritten.Whitespace;
return null;
}

2
NRefactory/ICSharpCode.NRefactory/CSharp/OutputVisitor/TextWriterOutputFormatter.cs

@ -88,7 +88,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -88,7 +88,7 @@ namespace ICSharpCode.NRefactory.CSharp
indentation--;
}
public void WriteComment(CommentType commentType, string content, bool isLastLine = false)
public void WriteComment(CommentType commentType, string content)
{
WriteIndentation();
switch (commentType) {

Loading…
Cancel
Save