Beispiel #1
0
        internal static bool ConstraintHasFix(MemberAccessExpressionSyntax memberAccess)
        {
            var memberAccessMethodName = memberAccess.Name.Identifier.Text;

            if (!ConstraintMethodNames.Contains(memberAccessMethodName))
            {
                return(false);
            }

            var lookupName = $"{memberAccess.Expression}.{memberAccess.Name.Identifier.Text}";

            return(ConstraintFixMap.ContainsKey(lookupName));
        }
Beispiel #2
0
        internal static bool TryGetConstraintFixExpression(MemberAccessExpressionSyntax memberAccess,
                                                           out ExpressionSyntax fixExpression)
        {
            var memberAccessMethodName = memberAccess.Name.Identifier.Text;

            fixExpression = null;
            if (!ConstraintMethodNames.Contains(memberAccessMethodName))
            {
                return(false);
            }

            var lookupName = $"{memberAccess.Expression}.{memberAccess.Name.Identifier.Text}";

            if (!ConstraintFixMap.TryGetValue(lookupName, out fixExpression))
            {
                return(false);
            }

            return(true);
        }