34 references to Feature
Microsoft.CodeAnalysis.CSharp.Features (15)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
16
private sealed class CSharpAnalyzer(ISyntaxFacts syntaxFacts,
Feature
features) : Analyzer(syntaxFacts, features)
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.cs (9)
30
var
features =
31
(version >= LanguageVersion.CSharp7 ?
Feature
.SourcePattern |
Feature
.IsTypePattern |
Feature
.CaseGuard : 0) |
32
(version >= LanguageVersion.CSharp8 ?
Feature
.SwitchExpression : 0) |
33
(version >= LanguageVersion.CSharp9 ?
Feature
.RelationalPattern |
Feature
.OrPattern |
Feature
.AndPattern |
Feature
.TypePattern : 0);
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (5)
31
ExpressionSyntax target, ImmutableArray<AnalyzedSwitchSection> sections,
Feature
feature)
37
private static SwitchExpressionArmSyntax AsSwitchExpressionArmSyntax(AnalyzedSwitchSection section,
Feature
feature)
89
public override SyntaxNode AsSwitchLabelSyntax(AnalyzedSwitchLabel label,
Feature
feature)
95
private static PatternSyntax AsPatternSyntax(AnalyzedPattern pattern,
Feature
feature)
101
AnalyzedPattern.Type p when feature.HasFlag(
Feature
.TypePattern) => TypePattern((TypeSyntax)p.IsExpressionSyntax.Right),
Microsoft.CodeAnalysis.Features (19)
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (12)
47
internal abstract class Analyzer(ISyntaxFacts syntaxFacts, AbstractConvertIfToSwitchCodeRefactoringProvider<TIfStatementSyntax, TExpressionSyntax, TIsExpressionSyntax, TPatternSyntax>.
Feature
features)
67
public
Feature
Features { get; } = features;
69
public bool Supports(
Feature
feature)
282
when Supports(
Feature
.RangePattern) && GetRangeBounds(op) is (TExpressionSyntax lower, TExpressionSyntax higher):
296
when Supports(
Feature
.InequalityPattern):
300
when Supports(
Feature
.RelationalPattern) && IsRelationalOperator(op.OperatorKind):
306
when Supports(
Feature
.AndPattern |
Feature
.CaseGuard):
312
if (Supports(
Feature
.AndPattern))
323
if (Supports(
Feature
.CaseGuard) && op.RightOperand.Syntax is TExpressionSyntax node)
333
when Supports(
Feature
.IsTypePattern) && CheckTargetExpression(op.ValueOperand) && op.Syntax is TIsExpressionSyntax node:
337
when Supports(
Feature
.SourcePattern) && CheckTargetExpression(op.Value) && op.Pattern.Syntax is TPatternSyntax pattern:
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.cs (3)
59
if (analyzer.Supports(
Feature
.SwitchExpression) &&
60
CanConvertToSwitchExpression(analyzer.Supports(
Feature
.OrPattern), sections))
254
if (convertToSwitchExpression && !CanConvertToSwitchExpression(analyzer.Supports(
Feature
.OrPattern), sections))
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (4)
21
public abstract SyntaxNode CreateSwitchExpressionStatement(TExpressionSyntax target, ImmutableArray<AnalyzedSwitchSection> sections,
Feature
feature);
24
public abstract SyntaxNode AsSwitchLabelSyntax(AnalyzedSwitchLabel label,
Feature
feature);
32
Feature
feature,
58
private SyntaxNode AsSwitchSectionSyntax(AnalyzedSwitchSection section, SyntaxGenerator generator,
Feature
feature)