Exemple #1
0
 private static void CheckCall(OpCodeAttribute attribute)
 {
     if (!IsCall(attribute))
     {
         throw new System.Exception("OpCode is not a call : " + attribute.OpCode.ToString());
     }
 }
Exemple #2
0
        public static bool ContainDelegate(OpCode code)
        {
            OpCodeAttribute attribute = GetOpCodeAttribute(code);

            CheckCall(attribute);

            return(attribute.Flags.Contains(CallFlags.Delegate));
        }
Exemple #3
0
        public static OpCodeAttribute GetOpCodeAttribute(OpCode code)
        {
            FieldInfo info = typeof(OpCode).GetField(code.ToString());

            if (info == null)
            {
                throw new System.Exception("Invalid OpCode");
            }

            OpCodeAttribute attribute = (OpCodeAttribute)info.GetCustomAttribute(typeof(OpCodeAttribute));

            if (attribute == null)
            {
                throw new System.Exception("Invalid OpCodeAttribute type");
            }

            return(attribute);
        }
Exemple #4
0
 private static bool IsCall(OpCodeAttribute attribute)
 {
     return(attribute.Flags.Contains(CallFlags.Call));
 }
Exemple #5
0
        public static OpCodeAttribute.Tier ToTier(OpCode code)
        {
            OpCodeAttribute attribute = GetOpCodeAttribute(code);

            return(attribute.OpCodeTier);
        }
Exemple #6
0
        public static int ToResult(OpCode code)
        {
            OpCodeAttribute attribute = GetOpCodeAttribute(code);

            return(attribute.Result);
        }
Exemple #7
0
        public static byte ToCode(OpCode code)
        {
            OpCodeAttribute attribute = GetOpCodeAttribute(code);

            return(attribute.OpCode);
        }