|
|
@ -6,6 +6,7 @@ |
|
|
|
// </file>
|
|
|
|
// </file>
|
|
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.Diagnostics; |
|
|
@ -243,6 +244,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
{ |
|
|
|
{ |
|
|
|
outputFormatter.PrintIdentifier(attribute.Name); |
|
|
|
outputFormatter.PrintIdentifier(attribute.Name); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
this.AppendCommaSeparatedList(attribute.PositionalArguments); |
|
|
|
this.AppendCommaSeparatedList(attribute.PositionalArguments); |
|
|
|
|
|
|
|
|
|
|
|
if (attribute.NamedArguments != null && attribute.NamedArguments.Count > 0) { |
|
|
|
if (attribute.NamedArguments != null && attribute.NamedArguments.Count > 0) { |
|
|
@ -256,6 +260,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -480,7 +487,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && delegateDeclaration.Parameters.Any (); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(delegateDeclaration.Parameters); |
|
|
|
AppendCommaSeparatedList(delegateDeclaration.Parameters); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
foreach (TemplateDefinition templateDefinition in delegateDeclaration.Templates) { |
|
|
|
foreach (TemplateDefinition templateDefinition in delegateDeclaration.Templates) { |
|
|
|
TrackVisit(templateDefinition, data); |
|
|
|
TrackVisit(templateDefinition, data); |
|
|
@ -719,11 +733,18 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && methodDeclaration.Parameters.Any (); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
if (methodDeclaration.IsExtensionMethod) { |
|
|
|
if (methodDeclaration.IsExtensionMethod) { |
|
|
|
outputFormatter.PrintToken(Tokens.This); |
|
|
|
outputFormatter.PrintToken(Tokens.This); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
AppendCommaSeparatedList(methodDeclaration.Parameters); |
|
|
|
AppendCommaSeparatedList(methodDeclaration.Parameters); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) { |
|
|
|
foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) { |
|
|
|
TrackVisit(templateDefinition, null); |
|
|
|
TrackVisit(templateDefinition, null); |
|
|
@ -860,7 +881,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && constructorDeclaration.Parameters.Any (); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(constructorDeclaration.Parameters); |
|
|
|
AppendCommaSeparatedList(constructorDeclaration.Parameters); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
TrackVisit(constructorDeclaration.ConstructorInitializer, data); |
|
|
|
TrackVisit(constructorDeclaration.ConstructorInitializer, data); |
|
|
|
OutputBlock(constructorDeclaration.Body, this.prettyPrintOptions.ConstructorBraceStyle); |
|
|
|
OutputBlock(constructorDeclaration.Body, this.prettyPrintOptions.ConstructorBraceStyle); |
|
|
@ -881,7 +909,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.PrintToken(Tokens.This); |
|
|
|
outputFormatter.PrintToken(Tokens.This); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(constructorInitializer.Arguments); |
|
|
|
AppendCommaSeparatedList(constructorInitializer.Arguments); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1210,7 +1244,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinIfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(ifElseStatement.Condition, data); |
|
|
|
TrackVisit(ifElseStatement.Condition, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinIfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
PrintIfSection(ifElseStatement.TrueStatement); |
|
|
|
PrintIfSection(ifElseStatement.TrueStatement); |
|
|
@ -1257,7 +1297,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinIfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(elseIfSection.Condition, data); |
|
|
|
TrackVisit(elseIfSection.Condition, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinIfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(elseIfSection.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(elseIfSection.EmbeddedStatement); |
|
|
@ -1272,6 +1318,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.DoIndent = false; |
|
|
|
outputFormatter.DoIndent = false; |
|
|
|
outputFormatter.DoNewLine = false; |
|
|
|
outputFormatter.DoNewLine = false; |
|
|
|
outputFormatter.EmitSemicolon = false; |
|
|
|
outputFormatter.EmitSemicolon = false; |
|
|
@ -1307,6 +1356,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.EmitSemicolon = true; |
|
|
|
outputFormatter.EmitSemicolon = true; |
|
|
|
outputFormatter.DoNewLine = true; |
|
|
|
outputFormatter.DoNewLine = true; |
|
|
@ -1353,7 +1405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinSwitchParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(switchStatement.SwitchExpression, data); |
|
|
|
TrackVisit(switchStatement.SwitchExpression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinSwitchParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenCurlyBrace); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenCurlyBrace); |
|
|
@ -1498,6 +1556,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinWhileParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (doLoopStatement.ConditionType == ConditionType.Until) { |
|
|
|
if (doLoopStatement.ConditionType == ConditionType.Until) { |
|
|
|
outputFormatter.PrintToken(Tokens.Not); |
|
|
|
outputFormatter.PrintToken(Tokens.Not); |
|
|
@ -1513,6 +1574,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
if (doLoopStatement.ConditionType == ConditionType.Until) { |
|
|
|
if (doLoopStatement.ConditionType == ConditionType.Until) { |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinWhileParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1547,6 +1611,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForEachParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(foreachStatement.TypeReference, data); |
|
|
|
TrackVisit(foreachStatement.TypeReference, data); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.PrintIdentifier(foreachStatement.VariableName); |
|
|
|
outputFormatter.PrintIdentifier(foreachStatement.VariableName); |
|
|
@ -1554,6 +1621,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.PrintToken(Tokens.In); |
|
|
|
outputFormatter.PrintToken(Tokens.In); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
TrackVisit(foreachStatement.Expression, data); |
|
|
|
TrackVisit(foreachStatement.Expression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForEachParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(foreachStatement.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(foreachStatement.EmbeddedStatement); |
|
|
@ -1568,7 +1638,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinLockParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(lockStatement.LockExpression, data); |
|
|
|
TrackVisit(lockStatement.LockExpression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinLockParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(lockStatement.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(lockStatement.EmbeddedStatement); |
|
|
@ -1583,7 +1659,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (prettyPrintOptions.WithinUsingParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
PrintStatementInline(usingStatement.ResourceAcquisition, data); |
|
|
|
PrintStatementInline(usingStatement.ResourceAcquisition, data); |
|
|
|
|
|
|
|
if (prettyPrintOptions.WithinUsingParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(usingStatement.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(usingStatement.EmbeddedStatement); |
|
|
@ -1635,11 +1717,17 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCatchParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintIdentifier(catchClause.TypeReference.Type); |
|
|
|
outputFormatter.PrintIdentifier(catchClause.TypeReference.Type); |
|
|
|
if (catchClause.VariableName.Length > 0) { |
|
|
|
if (catchClause.VariableName.Length > 0) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.PrintIdentifier(catchClause.VariableName); |
|
|
|
outputFormatter.PrintIdentifier(catchClause.VariableName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCatchParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
WriteEmbeddedStatement(catchClause.StatementBlock); |
|
|
|
WriteEmbeddedStatement(catchClause.StatementBlock); |
|
|
@ -1664,7 +1752,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
PrintStatementInline(fixedStatement.PointerDeclaration, data); |
|
|
|
PrintStatementInline(fixedStatement.PointerDeclaration, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(fixedStatement.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(fixedStatement.EmbeddedStatement); |
|
|
@ -1711,6 +1805,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.PrintToken(Tokens.For); |
|
|
|
outputFormatter.PrintToken(Tokens.For); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
if (forNextStatement.LoopVariableExpression.IsNull) { |
|
|
|
if (forNextStatement.LoopVariableExpression.IsNull) { |
|
|
|
if (!forNextStatement.TypeReference.IsNull) { |
|
|
|
if (!forNextStatement.TypeReference.IsNull) { |
|
|
|
TrackVisit(forNextStatement.TypeReference, data); |
|
|
|
TrackVisit(forNextStatement.TypeReference, data); |
|
|
@ -1757,6 +1854,9 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
TrackVisit(forNextStatement.Step, data); |
|
|
|
TrackVisit(forNextStatement.Step, data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinForParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
|
|
|
|
|
|
|
|
WriteEmbeddedStatement(forNextStatement.EmbeddedStatement); |
|
|
|
WriteEmbeddedStatement(forNextStatement.EmbeddedStatement); |
|
|
@ -1922,9 +2022,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(binaryOperatorExpression.Left, data); |
|
|
|
TrackVisit(binaryOperatorExpression.Left, data); |
|
|
|
PrintFormattedComma(); |
|
|
|
PrintFormattedComma(); |
|
|
|
TrackVisit(binaryOperatorExpression.Right, data); |
|
|
|
TrackVisit(binaryOperatorExpression.Right, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
case BinaryOperatorType.DictionaryAccess: |
|
|
|
case BinaryOperatorType.DictionaryAccess: |
|
|
@ -2058,11 +2164,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
|
|
|
|
|
|
|
|
case BinaryOperatorType.Equality: |
|
|
|
case BinaryOperatorType.Equality: |
|
|
|
case BinaryOperatorType.ReferenceEquality: |
|
|
|
case BinaryOperatorType.ReferenceEquality: |
|
|
|
if (prettyPrintOptions.AroundRelationalOperatorParentheses) { |
|
|
|
if (prettyPrintOptions.AroundEqualityOperatorParentheses) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.Equal); |
|
|
|
outputFormatter.PrintToken(Tokens.Equal); |
|
|
|
if (prettyPrintOptions.AroundRelationalOperatorParentheses) { |
|
|
|
if (prettyPrintOptions.AroundEqualityOperatorParentheses) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -2086,11 +2192,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
break; |
|
|
|
break; |
|
|
|
case BinaryOperatorType.InEquality: |
|
|
|
case BinaryOperatorType.InEquality: |
|
|
|
case BinaryOperatorType.ReferenceInequality: |
|
|
|
case BinaryOperatorType.ReferenceInequality: |
|
|
|
if (prettyPrintOptions.AroundRelationalOperatorParentheses) { |
|
|
|
if (prettyPrintOptions.AroundEqualityOperatorParentheses) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.NotEqual); |
|
|
|
outputFormatter.PrintToken(Tokens.NotEqual); |
|
|
|
if (prettyPrintOptions.AroundRelationalOperatorParentheses) { |
|
|
|
if (prettyPrintOptions.AroundEqualityOperatorParentheses) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -2133,7 +2239,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) |
|
|
|
public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) |
|
|
|
{ |
|
|
|
{ |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(parenthesizedExpression.Expression, data); |
|
|
|
TrackVisit(parenthesizedExpression.Expression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2147,7 +2259,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(invocationExpression.Arguments); |
|
|
|
AppendCommaSeparatedList(invocationExpression.Arguments); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2287,7 +2405,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinSizeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(sizeOfExpression.TypeReference, data); |
|
|
|
TrackVisit(sizeOfExpression.TypeReference, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinSizeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2299,7 +2423,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinTypeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(typeOfExpression.TypeReference, data); |
|
|
|
TrackVisit(typeOfExpression.TypeReference, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinTypeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2311,7 +2441,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinTypeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(defaultValueExpression.TypeReference, data); |
|
|
|
TrackVisit(defaultValueExpression.TypeReference, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinTypeOfParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2338,7 +2474,14 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
|
|
|
|
|
|
|
|
if (anonymousMethodExpression.Parameters.Count > 0 || anonymousMethodExpression.HasParameterList) { |
|
|
|
if (anonymousMethodExpression.Parameters.Count > 0 || anonymousMethodExpression.HasParameterList) { |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && anonymousMethodExpression.Parameters.Any (); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(anonymousMethodExpression.Parameters); |
|
|
|
AppendCommaSeparatedList(anonymousMethodExpression.Parameters); |
|
|
|
|
|
|
|
if (withinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
OutputBlockAllowInline(anonymousMethodExpression.Body, this.prettyPrintOptions.MethodBraceStyle, false); |
|
|
|
OutputBlockAllowInline(anonymousMethodExpression.Body, this.prettyPrintOptions.MethodBraceStyle, false); |
|
|
@ -2352,7 +2495,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.PrintIdentifier(lambdaExpression.Parameters[0].ParameterName); |
|
|
|
outputFormatter.PrintIdentifier(lambdaExpression.Parameters[0].ParameterName); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(lambdaExpression.Parameters); |
|
|
|
AppendCommaSeparatedList(lambdaExpression.Parameters); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
@ -2375,7 +2524,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(checkedExpression.Expression, data); |
|
|
|
TrackVisit(checkedExpression.Expression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2387,7 +2542,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(uncheckedExpression.Expression, data); |
|
|
|
TrackVisit(uncheckedExpression.Expression, data); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -2420,7 +2581,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
TrackVisit(castExpression.CastTo, data); |
|
|
|
TrackVisit(castExpression.CastTo, data); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (prettyPrintOptions.WithinCastParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
TrackVisit(castExpression.CastTo, data); |
|
|
|
TrackVisit(castExpression.CastTo, data); |
|
|
|
|
|
|
|
if (prettyPrintOptions.WithinCastParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
if (this.prettyPrintOptions.SpacesAfterTypecast) { |
|
|
|
if (this.prettyPrintOptions.SpacesAfterTypecast) { |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
@ -2485,7 +2652,13 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
outputFormatter.Space(); |
|
|
|
outputFormatter.Space(); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
AppendCommaSeparatedList(objectCreateExpression.Parameters); |
|
|
|
AppendCommaSeparatedList(objectCreateExpression.Parameters); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!objectCreateExpression.ObjectInitializer.IsNull) { |
|
|
|
if (!objectCreateExpression.ObjectInitializer.IsNull) { |
|
|
@ -2537,9 +2710,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter |
|
|
|
|
|
|
|
|
|
|
|
if (target is BinaryOperatorExpression || target is CastExpression) { |
|
|
|
if (target is BinaryOperatorExpression || target is CastExpression) { |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.OpenParenthesis); |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
TrackVisit(target, data); |
|
|
|
TrackVisit(target, data); |
|
|
|
if (target is BinaryOperatorExpression || target is CastExpression) { |
|
|
|
if (target is BinaryOperatorExpression || target is CastExpression) { |
|
|
|
|
|
|
|
if (this.prettyPrintOptions.WithinMethodCallParentheses) { |
|
|
|
|
|
|
|
outputFormatter.Space(); |
|
|
|
|
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
outputFormatter.PrintToken(Tokens.CloseParenthesis); |
|
|
|
} |
|
|
|
} |
|
|
|
outputFormatter.PrintToken(Tokens.Dot); |
|
|
|
outputFormatter.PrintToken(Tokens.Dot); |
|
|
|