예제 #1
0
 public static bool hasCflow(dnlib.DotNet.MethodDef methods)
 {
     for (int i = 0; i < methods.Body.Instructions.Count; i++)
     {
         if (methods.Body.Instructions[i].OpCode == OpCodes.Switch)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        internal MethodDef(Resolver resolver, dnlib.DotNet.MethodDef source)
            : base(resolver, source, ResolveOperator(source, resolver, out var isOperator))
        {
            // If the source is null..
            if (source is null)
            {
                // throw an exception
                throw new ArgumentNullException(nameof(source));
            }

            Operator    = isOperator;
            IsAsync     = ResolveAsync(source);
            Inheritance = ResolveInheritance(source);
            Generics    = ResolveGenerics(source, resolver);
            Returns     = ResolveReturn(source);
        }
예제 #3
0
        private static MemberInheritance ResolveInheritance(dnlib.DotNet.MethodDef source)
        {
            if (source.IsVirtual && (source.Attributes & MethodAttributes.NewSlot) == 0)
            {
                return(MemberInheritance.Override);
            }
            if (source.IsAbstract)
            {
                return(MemberInheritance.Abstract);
            }
            if (source.IsVirtual)
            {
                return(MemberInheritance.Virtual);
            }

            return(MemberInheritance.Normal);
        }
예제 #4
0
 private static AccessorType ResolveAccessor(dnlib.DotNet.MethodDef method)
 => method.Access switch
 {
예제 #5
0
 static string RetrieveConverterName(Resolver resolver, dnlib.DotNet.MethodDef input)
 => resolver.Resolve(input.ReturnType).DisplayName;
예제 #6
0
 // ReSharper disable once CyclomaticComplexity
 private static string ResolveOperator(dnlib.DotNet.MethodDef source, Resolver resolver, out OperatorType @operator)
 {
     // Assume that the source is a normal operator
     @operator = OperatorType.Normal;