Esempio n. 1
0
 private static MrMethod TryGetEtter(
     MrType declaringType,
     MethodDefinitionHandle methodDefinitionHandle,
     bool publicishOnly)
 {
     if (!methodDefinitionHandle.IsNil)
     {
         var methodDefinition = declaringType.Assembly.Reader.GetMethodDefinition(methodDefinitionHandle);
         var attributes       = methodDefinition.Attributes;
         if (!publicishOnly || MrMethod.AreAttributesPublicish(attributes, declaringType))
         {
             return(new MrMethod(methodDefinitionHandle, declaringType, methodDefinition));
         }
     }
     return(null);
 }
Esempio n. 2
0
        static internal MrEvent TryGetEvent(
            EventDefinitionHandle eventDefinitionHandle,
            MrType declaringType,
            bool publicishOnly)
        {
            var eventDefinition = declaringType.Assembly.Reader.GetEventDefinition(eventDefinitionHandle);

            if (publicishOnly)
            {
                var eventAccessors  = eventDefinition.GetAccessors();
                var adderDefinition = declaringType.Assembly.Reader.GetMethodDefinition(eventAccessors.Adder);
                if (!MrMethod.AreAttributesPublicish(adderDefinition.Attributes, declaringType))
                {
                    return(null);
                }
            }

            return(new MrEvent(eventDefinitionHandle, eventDefinition, declaringType));
        }