public override void VisitParameterReference(IParameterReferenceOperation operation)
    {
        var visitor = new NullableParameterVisitor();

        visitor.Visit(operation.Parameter);
        if (visitor.IsNullableParameter)
        {
            MatchedNullableParameter = operation.Parameter;
        }
    }
示例#2
0
    public override void VisitParameterList(ParameterListSyntax node)
    {
        var parameters = node.Parameters;
        var builder    = ImmutableArray.CreateBuilder <NullableParameter>();

        for (int i = 0; i < parameters.Count; i++)
        {
            var parameter = parameters[i];
            var symbol    = model.GetDeclaredSymbol(parameter, token);
            if (symbol is null)
            {
                continue;
            }
            var visitor = new NullableParameterVisitor();
            visitor.Visit(symbol);
            if (visitor.IsNullableParameter && !visitor.IsAnnotated)
            {
                builder.Add(new NullableParameter(i, parameter, symbol));
            }
        }
        NullableParameters = builder.ToImmutable();
    }