public override Location VisitSingleValueCaseClause([NotNull] ISingleValueCaseClauseOperation operation, [CanBeNull] object argument) { var syntax = (SwitchLabelSyntax)operation.Syntax; return(syntax.Keyword.GetLocation()); }
private bool ProcessAsField([NotNull] ISingleValueCaseClauseOperation caseClause) { if (caseClause.Value is IFieldReferenceOperation enumField) { caseClauseValues.Add(enumField.Field); return(true); } return(false); }
private bool ProcessAsLiteralSyntax([NotNull] SwitchAnalysisContext analysisContext, [NotNull] ISingleValueCaseClauseOperation caseClause) { if (caseClause.Value.Syntax is LiteralExpressionSyntax literalSyntax) { if (ProcessLiteralSyntaxAsTrueKeyword(analysisContext, literalSyntax) || ProcessLiteralSyntaxAsFalseKeyword(analysisContext, literalSyntax) || ProcessLiteralSyntaxAsNullKeyword(literalSyntax)) { return(true); } } return(false); }
private bool ProcessAsConversion([NotNull] SwitchAnalysisContext analysisContext, [NotNull] ISingleValueCaseClauseOperation caseClause) { var conversion = caseClause.Value as IConversionOperation; var memberSyntax = conversion?.Syntax as MemberAccessExpressionSyntax; IFieldSymbol field = analysisContext.GetFieldOrNull(memberSyntax); if (field != null) { caseClauseValues.Add(field); return(true); } return(false); }
public override void VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation) { Assert.Equal(OperationKind.CaseClause, operation.Kind); Assert.Equal(CaseKind.SingleValue, operation.CaseKind); // It is unexpected to have null operation.Value. The conditional logic is added // as a work around for https://github.com/dotnet/roslyn/issues/23795 and should be removed // once the issue is fixed if (operation.Value == null) { Assert.Equal(LanguageNames.VisualBasic, operation.Language); Assert.Empty(operation.Children); } else { AssertEx.Equal(new[] { operation.Value }, operation.Children); } }
public override IOperation VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation, object argument) { return(new SingleValueCaseClause(operation.Label, Visit(operation.Value), ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit)); }
public virtual void VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation) { DefaultVisit(operation); }
public override void VisitSingleValueCaseClause([NotNull] ISingleValueCaseClauseOperation operation) { base.VisitSingleValueCaseClause(operation); }
public override void VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation) { var caseKind = operation.CaseKind; base.VisitSingleValueCaseClause(operation); }
public override bool VisitSingleValueCaseClause([NotNull] ISingleValueCaseClauseOperation operation1, [CanBeNull] IOperation argument) { return(argument is ISingleValueCaseClauseOperation operation2 && AreBaseOperationsEqual(operation1, operation2) && operation1.CaseKind == operation2.CaseKind); }
public override void VisitSingleValueCaseClause(ISingleValueCaseClauseOperation operation) { VisitCaseClauseOperation(operation); Assert.Equal(CaseKind.SingleValue, operation.CaseKind); AssertEx.Equal(new[] { operation.Value }, operation.Children); }