提交 4a180e39 编写于 作者: S Sam Harwell

Avoid passing options to AddAnchorIndentationOperations

上级 8df8f936
......@@ -269,7 +269,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.LineCommit
Private Class NoAnchorFormatterRule
Inherits CompatAbstractFormattingRule
Public Overrides Sub AddAnchorIndentationOperationsSlow(list As List(Of AnchorIndentationOperation), node As SyntaxNode, options As AnalyzerConfigOptions, ByRef nextOperation As NextAnchorIndentationOperationAction)
Public Overrides Sub AddAnchorIndentationOperationsSlow(list As List(Of AnchorIndentationOperation), node As SyntaxNode, ByRef nextOperation As NextAnchorIndentationOperationAction)
' no anchor/relative formatting
Return
End Sub
......
......@@ -55,7 +55,7 @@ public override AdjustNewLinesOperation GetAdjustNewLinesOperation(SyntaxToken p
return operation;
}
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
if (node.IsKind(SyntaxKind.SimpleLambdaExpression) || node.IsKind(SyntaxKind.ParenthesizedLambdaExpression) || node.IsKind(SyntaxKind.AnonymousMethodExpression))
{
......
......@@ -11,7 +11,6 @@
using Microsoft.CodeAnalysis.CSharp.DocumentationComments;
using Microsoft.CodeAnalysis.CSharp.Simplification;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.DocumentationComments;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Formatting.Rules;
......@@ -115,7 +114,7 @@ protected override AdjustNewLinesOperation GetAdjustNewLinesOperationBetweenMemb
return FormattingOperations.CreateAdjustNewLinesOperation(GetNumberOfLines(triviaList) + 1, AdjustNewLinesOption.ForceLines);
}
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
return;
}
......
......@@ -25,10 +25,10 @@ public override sealed void AddSuppressOperations(List<SuppressOperation> list,
[Obsolete("Do not call this method directly (it will Stack Overflow).", error: true)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override sealed void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override sealed void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
var nextOperationCopy = nextOperation;
AddAnchorIndentationOperationsSlow(list, node, options, ref nextOperationCopy);
AddAnchorIndentationOperationsSlow(list, node, ref nextOperationCopy);
}
[Obsolete("Do not call this method directly (it will Stack Overflow).", error: true)]
......@@ -74,8 +74,8 @@ public virtual void AddSuppressOperationsSlow(List<SuppressOperation> list, Synt
/// <summary>
/// returns AnchorIndentationOperations under a node either by itself or by filtering/replacing operations returned by NextOperation
/// </summary>
public virtual void AddAnchorIndentationOperationsSlow(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, ref NextAnchorIndentationOperationAction nextOperation)
=> base.AddAnchorIndentationOperations(list, node, options, in nextOperation);
public virtual void AddAnchorIndentationOperationsSlow(List<AnchorIndentationOperation> list, SyntaxNode node, ref NextAnchorIndentationOperationAction nextOperation)
=> base.AddAnchorIndentationOperations(list, node, in nextOperation);
/// <summary>
/// returns IndentBlockOperations under a node either by itself or by filtering/replacing operations returned by NextOperation
......
......@@ -5,7 +5,6 @@
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.CodeGeneration
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.DocumentationComments
Imports Microsoft.CodeAnalysis.Formatting
Imports Microsoft.CodeAnalysis.Formatting.Rules
......@@ -108,7 +107,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.MetadataAsSource
Return FormattingOperations.CreateAdjustNewLinesOperation(GetNumberOfLines(triviaList) + 1, AdjustNewLinesOption.ForceLines)
End Function
Public Overrides Sub AddAnchorIndentationOperationsSlow(list As List(Of AnchorIndentationOperation), node As SyntaxNode, options As AnalyzerConfigOptions, ByRef nextOperation As NextAnchorIndentationOperationAction)
Public Overrides Sub AddAnchorIndentationOperationsSlow(list As List(Of AnchorIndentationOperation), node As SyntaxNode, ByRef nextOperation As NextAnchorIndentationOperationAction)
Return
End Sub
......
......@@ -26,7 +26,7 @@ public override void AddSuppressOperations(List<SuppressOperation> list, SyntaxN
{
}
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
}
......
......@@ -6,7 +6,6 @@
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Formatting.Rules;
namespace Microsoft.CodeAnalysis.CSharp.Formatting
......@@ -15,7 +14,7 @@ internal class AnchorIndentationFormattingRule : BaseFormattingRule
{
internal const string Name = "CSharp Anchor Indentation Formatting Rule";
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
nextOperation.Invoke();
......
......@@ -84,7 +84,7 @@ public override void AddIndentBlockOperations(List<IndentBlockOperation> list, S
}
}
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
nextOperation.Invoke();
switch (node)
......
......@@ -54,7 +54,7 @@ public void AddSuppressOperations(List<SuppressOperation> list, SyntaxNode curre
public void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode currentNode)
{
var action = new NextAnchorIndentationOperationAction(_addAnchorIndentationOperationsRules, index: 0, currentNode, _options, list);
var action = new NextAnchorIndentationOperationAction(_addAnchorIndentationOperationsRules, index: 0, currentNode, list);
action.Invoke();
}
......
......@@ -28,7 +28,7 @@ public virtual void AddSuppressOperations(List<SuppressOperation> list, SyntaxNo
/// <summary>
/// returns AnchorIndentationOperations under a node either by itself or by filtering/replacing operations returned by NextOperation
/// </summary>
public virtual void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public virtual void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
=> nextOperation.Invoke();
/// <summary>
......
......@@ -24,10 +24,10 @@ public override sealed void AddSuppressOperations(List<SuppressOperation> list,
[Obsolete("Do not call this method directly (it will Stack Overflow).", error: true)]
[EditorBrowsable(EditorBrowsableState.Never)]
public override sealed void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, in NextAnchorIndentationOperationAction nextOperation)
public override sealed void AddAnchorIndentationOperations(List<AnchorIndentationOperation> list, SyntaxNode node, in NextAnchorIndentationOperationAction nextOperation)
{
var nextOperationCopy = nextOperation;
AddAnchorIndentationOperationsSlow(list, node, options, ref nextOperationCopy);
AddAnchorIndentationOperationsSlow(list, node, ref nextOperationCopy);
}
[Obsolete("Do not call this method directly (it will Stack Overflow).", error: true)]
......@@ -73,8 +73,8 @@ public virtual void AddSuppressOperationsSlow(List<SuppressOperation> list, Synt
/// <summary>
/// returns AnchorIndentationOperations under a node either by itself or by filtering/replacing operations returned by NextOperation
/// </summary>
public virtual void AddAnchorIndentationOperationsSlow(List<AnchorIndentationOperation> list, SyntaxNode node, AnalyzerConfigOptions options, ref NextAnchorIndentationOperationAction nextOperation)
=> base.AddAnchorIndentationOperations(list, node, options, in nextOperation);
public virtual void AddAnchorIndentationOperationsSlow(List<AnchorIndentationOperation> list, SyntaxNode node, ref NextAnchorIndentationOperationAction nextOperation)
=> base.AddAnchorIndentationOperations(list, node, in nextOperation);
/// <summary>
/// returns IndentBlockOperations under a node either by itself or by filtering/replacing operations returned by NextOperation
......
......@@ -6,7 +6,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Formatting.Rules
......@@ -17,25 +16,22 @@ namespace Microsoft.CodeAnalysis.Formatting.Rules
private readonly ImmutableArray<AbstractFormattingRule> _formattingRules;
private readonly int _index;
private readonly SyntaxNode _node;
private readonly AnalyzerConfigOptions _options;
private readonly List<AnchorIndentationOperation> _list;
public NextAnchorIndentationOperationAction(
ImmutableArray<AbstractFormattingRule> formattingRules,
int index,
SyntaxNode node,
AnalyzerConfigOptions options,
List<AnchorIndentationOperation> list)
{
_formattingRules = formattingRules;
_index = index;
_node = node;
_options = options;
_list = list;
}
private NextAnchorIndentationOperationAction NextAction
=> new NextAnchorIndentationOperationAction(_formattingRules, _index + 1, _node, _options, _list);
=> new NextAnchorIndentationOperationAction(_formattingRules, _index + 1, _node, _list);
public void Invoke()
{
......@@ -47,7 +43,7 @@ public void Invoke()
else
{
// Call the handler at the index, passing a continuation that will come back to here with index + 1
_formattingRules[_index].AddAnchorIndentationOperations(_list, _node, _options, NextAction);
_formattingRules[_index].AddAnchorIndentationOperations(_list, _node, NextAction);
return;
}
}
......
......@@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting
Public Overrides Sub AddSuppressOperationsSlow(operations As List(Of SuppressOperation), node As SyntaxNode, ByRef nextAction As NextSuppressOperationAction)
End Sub
Public Overrides Sub AddAnchorIndentationOperationsSlow(operations As List(Of AnchorIndentationOperation), node As SyntaxNode, options As AnalyzerConfigOptions, ByRef nextAction As NextAnchorIndentationOperationAction)
Public Overrides Sub AddAnchorIndentationOperationsSlow(operations As List(Of AnchorIndentationOperation), node As SyntaxNode, ByRef nextAction As NextAnchorIndentationOperationAction)
End Sub
Public Overrides Sub AddIndentBlockOperationsSlow(operations As List(Of IndentBlockOperation), node As SyntaxNode, options As AnalyzerConfigOptions, ByRef nextAction As NextIndentBlockOperationAction)
......
......@@ -15,7 +15,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting
Public Overrides Sub AddAnchorIndentationOperationsSlow(operations As List(Of AnchorIndentationOperation),
node As SyntaxNode,
options As AnalyzerConfigOptions,
ByRef nextOperation As NextAnchorIndentationOperationAction)
nextOperation.Invoke()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册