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