Exemplo n.º 1
0
        public static CustomAttribute GetInheritedAttribute(IEmitter emitter, IMemberDefinition member, string attrName)
        {
            foreach (var attr in member.CustomAttributes)
            {
                if (attr.AttributeType.FullName == attrName)
                {
                    return attr;
                }
            }

            var methodDefinition = member as MethodDefinition;
            if (methodDefinition != null)
            {
                var isOverride = methodDefinition.IsVirtual && methodDefinition.IsReuseSlot;

                if (isOverride)
                {
                    member = Helpers.GetBaseMethod(methodDefinition, emitter);

                    if (member != null)
                    {
                        return Helpers.GetInheritedAttribute(emitter, member, attrName);
                    }
                }
            }

            return null;
        }
Exemplo n.º 2
0
 public static MethodDefinition GetBaseMethod(MethodDefinition method, IEmitter emitter)
 {
     return(Helpers.GetBaseMethod(method.DeclaringType, method, emitter));
 }