|
|
|
@ -1,4 +1,4 @@ |
|
|
|
//
|
|
|
|
//
|
|
|
|
// AstFormattingVisitor.cs
|
|
|
|
// AstFormattingVisitor.cs
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Author:
|
|
|
|
// Author:
|
|
|
|
@ -1271,23 +1271,26 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!variableDeclarationStatement.SemicolonToken.IsNull) |
|
|
|
if (!variableDeclarationStatement.SemicolonToken.IsNull) |
|
|
|
FixStatementIndentation (variableDeclarationStatement.StartLocation); |
|
|
|
FixStatementIndentation (variableDeclarationStatement.StartLocation); |
|
|
|
|
|
|
|
|
|
|
|
if ((variableDeclarationStatement.Modifiers & Modifiers.Const) == Modifiers.Const) { |
|
|
|
if ((variableDeclarationStatement.Modifiers & Modifiers.Const) == Modifiers.Const) { |
|
|
|
ForceSpacesAround (variableDeclarationStatement.Type, true); |
|
|
|
ForceSpacesAround (variableDeclarationStatement.Type, true); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ForceSpacesAfter (variableDeclarationStatement.Type, true); |
|
|
|
ForceSpacesAfter (variableDeclarationStatement.Type, true); |
|
|
|
} |
|
|
|
} |
|
|
|
var lastLoc = variableDeclarationStatement.StartLocation; |
|
|
|
var lastLoc = variableDeclarationStatement.StartLocation; |
|
|
|
IndentLevel++; |
|
|
|
|
|
|
|
foreach (var initializer in variableDeclarationStatement.Variables) { |
|
|
|
foreach (var initializer in variableDeclarationStatement.Variables) { |
|
|
|
|
|
|
|
var indent = !(initializer.Initializer is AnonymousMethodExpression); |
|
|
|
|
|
|
|
if (indent) |
|
|
|
|
|
|
|
IndentLevel++; |
|
|
|
if (lastLoc.Line != initializer.StartLocation.Line) { |
|
|
|
if (lastLoc.Line != initializer.StartLocation.Line) { |
|
|
|
FixStatementIndentation (initializer.StartLocation); |
|
|
|
FixStatementIndentation (initializer.StartLocation); |
|
|
|
lastLoc = initializer.StartLocation; |
|
|
|
lastLoc = initializer.StartLocation; |
|
|
|
} |
|
|
|
} |
|
|
|
initializer.AcceptVisitor (this); |
|
|
|
initializer.AcceptVisitor (this); |
|
|
|
|
|
|
|
if (indent) |
|
|
|
|
|
|
|
IndentLevel--; |
|
|
|
} |
|
|
|
} |
|
|
|
IndentLevel--; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FormatCommas (variableDeclarationStatement, policy.SpaceBeforeLocalVariableDeclarationComma, policy.SpaceAfterLocalVariableDeclarationComma); |
|
|
|
FormatCommas (variableDeclarationStatement, policy.SpaceBeforeLocalVariableDeclarationComma, policy.SpaceAfterLocalVariableDeclarationComma); |
|
|
|
FixSemicolon (variableDeclarationStatement.SemicolonToken); |
|
|
|
FixSemicolon (variableDeclarationStatement.SemicolonToken); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1340,6 +1343,13 @@ namespace ICSharpCode.NRefactory.CSharp |
|
|
|
base.VisitComposedType (composedType); |
|
|
|
base.VisitComposedType (composedType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void VisitAnonymousMethodExpression (AnonymousMethodExpression anonymousMethodExpression) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!anonymousMethodExpression.Body.IsNull) |
|
|
|
|
|
|
|
EnforceBraceStyle (policy.AnonymousMethodBraceStyle, anonymousMethodExpression.Body.LBraceToken, anonymousMethodExpression.Body.RBraceToken); |
|
|
|
|
|
|
|
base.VisitAnonymousMethodExpression (anonymousMethodExpression); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override void VisitAssignmentExpression (AssignmentExpression assignmentExpression) |
|
|
|
public override void VisitAssignmentExpression (AssignmentExpression assignmentExpression) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ForceSpacesAround (assignmentExpression.OperatorToken, policy.SpaceAroundAssignment); |
|
|
|
ForceSpacesAround (assignmentExpression.OperatorToken, policy.SpaceAroundAssignment); |
|
|
|
|