Exemple #1
0
 public void ProcessAttributeDataflow(MethodDefinition method, IList <CustomAttributeArgument> arguments)
 {
     for (int i = 0; i < method.Parameters.Count; i++)
     {
         var parameterValue = _annotations.GetMethodParameterValue(method, i);
         if (parameterValue.DynamicallyAccessedMemberTypes != DynamicallyAccessedMemberTypes.None)
         {
             MultiValue value             = GetValueNodeForCustomAttributeArgument(arguments[i]);
             var        diagnosticContext = new DiagnosticContext(_origin, diagnosticsEnabled: true, _context);
             RequireDynamicallyAccessedMembers(diagnosticContext, value, parameterValue);
         }
     }
 }
        ValueWithDynamicallyAccessedMembers GetMethodParameterValue(MethodDefinition method, int parameterIndex, DynamicallyAccessedMemberTypes dynamicallyAccessedMemberTypes)
        {
            if (method.HasImplicitThis())
            {
                if (parameterIndex == 0)
                {
                    return(_annotations.GetMethodThisParameterValue(method, dynamicallyAccessedMemberTypes));
                }

                parameterIndex--;
            }

            return(_annotations.GetMethodParameterValue(method, parameterIndex, dynamicallyAccessedMemberTypes));
        }