예제 #1
0
        public static GhostFieldAttribute GetGhostFieldAttribute(Mono.Cecil.TypeReference parentType, Mono.Cecil.IMemberDefinition componentField)
        {
            if (parentType != null && GhostAuthoringModifiers.GhostDefaultOverrides.TryGetValue(parentType.FullName.Replace('/', '+'), out var newComponent))
            {
                foreach (var field in newComponent.fields)
                {
                    if (field.name == componentField.Name)
                    {
                        return(field.attribute);
                    }
                }
                return(default(GhostFieldAttribute));
            }

            var attribute = componentField.GetAttribute <GhostFieldAttribute>();

            if (attribute != null)
            {
                var fieldAttribute = new GhostFieldAttribute();
                if (attribute.HasProperties)
                {
                    foreach (var a in attribute.Properties)
                    {
                        typeof(GhostFieldAttribute).GetProperty(a.Name)?.SetValue(fieldAttribute, a.Argument.Value);
                    }
                }

                return(fieldAttribute);
            }
            return(default(GhostFieldAttribute));
        }
예제 #2
0
        private static Mono.Cecil.MethodReference CloneMethodWithDeclaringType(
            Mono.Cecil.MethodReference methodDef,
            Mono.Cecil.TypeReference declaringTypeRef)
        {
            if (!declaringTypeRef.IsGenericInstance || methodDef == null)
            {
                return(methodDef);
            }

            var methodRef = new Mono.Cecil.MethodReference(methodDef.Name, methodDef.ReturnType, declaringTypeRef)
            {
                CallingConvention = methodDef.CallingConvention,
                HasThis           = methodDef.HasThis,
                ExplicitThis      = methodDef.ExplicitThis
            };

            foreach (Mono.Cecil.GenericParameter genParamDef in methodDef.GenericParameters)
            {
                methodRef.GenericParameters.Add(CloneGenericParameter(genParamDef, methodRef));
            }

            methodRef.ReturnType = declaringTypeRef.Module.ImportReference(methodDef.ReturnType, methodRef);

            foreach (Mono.Cecil.ParameterDefinition paramDef in methodDef.Parameters)
            {
                methodRef.Parameters.Add(
                    new Mono.Cecil.ParameterDefinition(
                        paramDef.Name, paramDef.Attributes,
                        declaringTypeRef.Module.ImportReference(paramDef.ParameterType, methodRef)));
            }

            return(methodRef);
        }
예제 #3
0
 private Mono.Cecil.TypeReference InitStackVerificationType(Mono.Cecil.TypeReference mono_type)
 {
     if (_verification_type.FullName == typeof(sbyte).ToMonoTypeReference().FullName)
     {
         return(typeof(int).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(short).ToMonoTypeReference().FullName)
     {
         return(typeof(int).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(int).ToMonoTypeReference().FullName)
     {
         return(typeof(int).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(long).ToMonoTypeReference().FullName)
     {
         return(typeof(long).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(float).ToMonoTypeReference().FullName)
     {
         return(typeof(float).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(double).ToMonoTypeReference().FullName)
     {
         return(typeof(double).ToMonoTypeReference());
     }
     else if (_verification_type.FullName == typeof(bool).ToMonoTypeReference().FullName)
     {
         return(typeof(int).ToMonoTypeReference());
     }
     else
     {
         return(_cil_type);
     }
 }
예제 #4
0
        public TypeInformation(Mono.Cecil.IMemberDefinition field, Mono.Cecil.TypeReference fieldType, GhostFieldAttribute ghostField,
                               TypeAttribute inheritedAttribute, TypeAttribute.AttributeFlags inheritedAttributeMask, string parent = null)
        {
            Type          = fieldType;
            FieldName     = field.Name;
            DeclaringType = field.DeclaringType;
            Fields        = new List <TypeInformation>();
            Attribute     = inheritedAttribute;
            AttributeMask = inheritedAttributeMask;
            //Always reset the subtype. It cannot be inherithed like this
            Attribute.subtype = 0;
            //Reset flags based on inheritance mask
            Attribute.composite &= (AttributeMask & TypeAttribute.AttributeFlags.Composite) != 0;

            Attribute.smoothing &= inheritedAttribute.smoothing;

            if ((AttributeMask & TypeAttribute.AttributeFlags.Quantized) == 0)
            {
                Attribute.quantization = -1;
            }


            ParseAttribute(ghostField);
            Parent = string.IsNullOrEmpty(parent) ? "" : parent;
        }
예제 #5
0
 public TYPE(Mono.Cecil.TypeReference mono_type)
 {
     _cil_type                = mono_type;
     _verification_type       = InitVerificationType(_cil_type);
     _stack_verification_type = InitStackVerificationType(_verification_type);
     _intermediate_type_ref   = _stack_verification_type.ToTypeRef();
 }
예제 #6
0
 public TypeReference(IReflectionInfoFactory factory, Mono.Cecil.TypeReference type)
 {
     DeclaringType = type.DeclaringType == null ? null : factory.GetReference(type.DeclaringType);
     Namespace     = type.Namespace;
     Name          = type.IsGenericInstance && type.Name.Contains('`') ? string.Format("{0}<{1}>", type.Name.Substring(0, type.Name.IndexOf('`')), string.Join(",", type.GenericParameters.Select(t => t.IsGenericParameter ? string.Empty : factory.GetReference(t).Identity))) : type.Name;
     IsArray       = type.IsArray;
 }
예제 #7
0
        IMethod GetNewForArray(object token)
        {
            Mono.Cecil.ModuleDefinition module = null;
            string typename = null;

            if (token is Mono.Cecil.TypeDefinition)
            {
                Mono.Cecil.TypeDefinition _def = (token as Mono.Cecil.TypeDefinition);
                module   = _def.Module;
                typename = _def.FullName;
            }
            else if (token is Mono.Cecil.TypeReference)
            {
                Mono.Cecil.TypeReference _ref = (token as Mono.Cecil.TypeReference);
                module   = _ref.Module;
                typename = _ref.FullName;
            }
            else
            {
                throw new NotImplementedException();
            }

            ICLRType _Itype = GetType(typename, module);

            typename += "[]";
            //var _type = context.environment.GetType(typename, type.Module);
            var _type = GetType(typename, module);

            MethodParamList tlist = MethodParamList.MakeList_OneParam_Int(environment);
            var             m     = _type.GetMethod(".ctor", tlist);

            return(m);
        }
예제 #8
0
        public static bool IsBlittable(this Mono.Cecil.TypeReference type)
        {
            if (type.IsPrimitive || type.IsTypeOf <IntPtr>() || type.IsTypeOf <UIntPtr>())
            {
                return(true);
            }

            return(false);
        }
예제 #9
0
 /// <summary>
 /// Specialized helper constructor
 /// </summary>
 /// <param name="value">The item to use as the value</param>
 /// <param name="sourcetype">The data element type</param>
 public PrimitiveExpression(object value, Mono.Cecil.TypeReference sourcetype)
 {
     this.Value            = value;
     this.SourceResultType = sourcetype;
     if (sourcetype == null)
     {
         throw new ArgumentNullException(nameof(sourcetype));
     }
 }
예제 #10
0
        public TYPE(System.Type system_type)
        {
            var mono_type = system_type.ToMonoTypeReference();

            _cil_type                = mono_type;
            _verification_type       = InitVerificationType(_cil_type);
            _stack_verification_type = InitStackVerificationType(_verification_type);
            _intermediate_type_ref   = _stack_verification_type.ToTypeRef();
        }
예제 #11
0
        public static ulong ComputeVariantHash(Mono.Cecil.TypeReference variantType, Mono.Cecil.CustomAttribute attribute)
        {
            var hash          = TypeHash.FNV1A64(attribute.AttributeType.FullName);
            var componentType = attribute.ConstructorArguments[0].Value as Mono.Cecil.TypeReference;
            var variantName   = variantType.FullName;

            hash = TypeHash.CombineFNV1A64(hash, TypeHash.FNV1A64(componentType.FullName));
            hash = TypeHash.CombineFNV1A64(hash, TypeHash.FNV1A64(variantName));
            return(hash);
        }
예제 #12
0
        public static string GetFieldTypeName(this Mono.Cecil.TypeReference type)
        {
            if (type.IsTypeOf <Byte>())
            {
                return("byte");
            }
            if (type.IsTypeOf <SByte>())
            {
                return("sbyte");
            }
            if (type.IsTypeOf <Int16>())
            {
                return("short");
            }
            if (type.IsTypeOf <UInt16>())
            {
                return("ushort");
            }
            if (type.IsTypeOf <Int32>())
            {
                return("int");
            }
            if (type.IsTypeOf <UInt32>())
            {
                return("uint");
            }
            if (type.IsTypeOf <Int64>())
            {
                return("long");
            }
            if (type.IsTypeOf <UInt64>())
            {
                return("ulong");
            }

            if (type.IsTypeOf <IntPtr>())
            {
                return("iptr");
            }
            if (type.IsTypeOf <UIntPtr>())
            {
                return("uptr");
            }

            if (type.IsTypeOf <Single>())
            {
                return("float");
            }
            if (type.IsTypeOf <Double>())
            {
                return("double");
            }

            return(type.ToString().Replace("/", "."));
        }
예제 #13
0
        public TypeInformation(Mono.Cecil.TypeReference parentType, Mono.Cecil.FieldDefinition fieldInfo, TypeAttribute inheritedAttribute,
                               string parent = null)
        {
            FieldInfo = fieldInfo;
            Type      = fieldInfo.FieldType;
            Fields    = new List <TypeInformation>();
            Attribute = inheritedAttribute;

            ParseAttribute(CecilExtensions.GetGhostFieldAttribute(parentType, fieldInfo));
            Parent = string.IsNullOrEmpty(parent) ? "" : parent;
        }
예제 #14
0
 public static bool HasGhostFieldAttribute(Mono.Cecil.TypeReference parentType, Mono.Cecil.IMemberDefinition componentField)
 {
     if (!GhostAuthoringModifiers.GhostDefaultOverrides.TryGetValue(parentType.FullName.Replace('/', '+'), out var newComponent))
     {
         return(componentField.HasAttribute <GhostFieldAttribute>());
     }
     else
     {
         return(newComponent.fields.Any(f => f.name == componentField.Name));
     }
 }
예제 #15
0
        public static bool IsICommandData(this Mono.Cecil.TypeReference typedReference)
        {
            var resolvedType = typedReference.Resolve();

            if (resolvedType == null)
            {
                return(false);
            }
            return(resolvedType.Interfaces.Any(i => i.InterfaceType.Name == typeof(ICommandData).Name &&
                                               i.InterfaceType.Namespace == typeof(ICommandData).Namespace));
        }
예제 #16
0
 /// <summary>
 /// Creates an instruction that sets up an exception handler.
 /// </summary>
 /// <param name="type">
 /// The type of exception handler to create.
 /// </param>
 /// <param name="catchType">
 /// The type of exception that can be caught by the exception
 /// handler. Only applies to 'catch' exception handlers.
 /// </param>
 /// <param name="tryBlock">
 /// The contents of the 'try' block of the exception handler.
 /// </param>
 /// <param name="handlerBlock">
 /// The contents of the actual exception handler block.
 /// </param>
 public CilExceptionHandlerInstruction(
     Mono.Cecil.Cil.ExceptionHandlerType type,
     Mono.Cecil.TypeReference catchType,
     IReadOnlyList <CilCodegenInstruction> tryBlock,
     IReadOnlyList <CilCodegenInstruction> handlerBlock)
 {
     this.Type         = type;
     this.CatchType    = catchType;
     this.TryBlock     = tryBlock;
     this.HandlerBlock = handlerBlock;
 }
예제 #17
0
		internal void AnalyzeType(Type type)
		{
			var shouldUse =
				(ExpressionType == null) ||
				(type == typeof(bool)) ||
				(type == typeof(double) && ExpressionType.FullName == typeof(int).FullName);

			if (shouldUse)
			{
				ExpressionType = parser.MethodBody.GetCecilModule().Import(type);
			}
		}
예제 #18
0
		internal void AnalyzeType(Mono.Cecil.TypeReference type)
		{
			var shouldUse =
				(ExpressionType == null) ||
				(type.FullName == typeof(bool).FullName) ||
				(type.FullName == typeof(double).FullName && ExpressionType.FullName == typeof(int).FullName);

			if (shouldUse)
			{
				ExpressionType = type;
			}
		}
예제 #19
0
        public static bool IsGhostComponent(this Mono.Cecil.TypeReference typeReference)
        {
            var resolvedType = typeReference.Resolve();

            if (resolvedType == null)
            {
                return(false);
            }

            return(resolvedType.CustomAttributes.Any(a =>
                                                     a.AttributeType.FullName == typeof(GhostComponentAttribute).FullName));
        }
예제 #20
0
 private static void ConvertMethodDefinition(MethodReference method, TypeReference enumType)
 {
     if (method.ReturnType.FullName == SystemEnumName)
     {
         method.ReturnType = enumType;
     }
     foreach (var p in method.Parameters)
     {
         if (p.ParameterType.FullName == SystemEnumName)
         {
             p.ParameterType = enumType;
         }
     }
 }
예제 #21
0
        public TypeDescription(Mono.Cecil.TypeReference typeReference, TypeAttribute attribute)
        {
            TypeFullName = typeReference.FullName.Replace("/", "+");

            if (!typeReference.IsPrimitive && typeReference.Resolve().IsEnum)
            {
                Key = typeof(Enum).FullName;
            }
            else
            {
                Key = TypeFullName;
            }
            Attribute = attribute;
        }
예제 #22
0
        public static string GetFriendlyTypeNameMono(Mono.Cecil.TypeReference type)
        {
            if (type.IsGenericParameter)
            {
                return(Simplify(type.Name));
            }

            if (!type.HasGenericParameters)
            {
                return(Simplify(type.FullName));
            }

            StringBuilder builder = new StringBuilder();
            String        name    = Simplify(type.Name);

            // If generic, then a backtick occurs in the name. In that case, remove the trailing information.
            String pre;
            int    index = name.IndexOf("`");

            if (index >= 0)
            {
                pre = String.Format("{0}.{1}", type.Namespace, Simplify(name.Substring(0, index)));
            }
            else
            {
                pre = String.Format("{0}.{1}", type.Namespace, Simplify(name));
            }
            pre = Simplify(pre);
            builder.Append(pre);
            builder.Append('<');
            bool first = true;

            foreach (Mono.Cecil.GenericParameter arg in type.GenericParameters)
            {
                if (!first)
                {
                    builder.Append(',');
                }
                builder.Append(GetFriendlyTypeNameMono(arg));
                first = false;
            }
            builder.Append('>');
            // Convert "+" signs into "." since it's just a nested class.
            String result = builder.ToString();

            result = result.Replace('+', '.');
            return(result);
        }
 private string GetAtomicFieldUpdaterType(Mono.Cecil.TypeReference fieldType)
 {
     if (fieldType.IsInt64())
     {
         return("AtomicLongFieldUpdater`1");
     }
     if (fieldType.IsInt32())
     {
         return("AtomicIntegerFieldUpdater`1");
     }
     if (fieldType.IsPrimitive)
     {
         return(null);
     }
     return("AtomicReferenceFieldUpdater`2");
 }
예제 #24
0
        private static bool IsUnifiableMono(Type t1, Mono.Cecil.TypeReference t2)
        {
            // If both are not generic then they have to be equal types.
            if ((!t1.IsGenericParameter) && (!t2.IsGenericParameter))
            {
                return(t1.Name == t2.Name);
            }

            // Handle any generic arguments
            if (t1.IsGenericType && t2.HasGenericParameters)
            {
                Type[] t1Arguments = t1.GetGenericArguments();
                Mono.Collections.Generic.Collection <Mono.Cecil.GenericParameter> t2Arguments = t2.GenericParameters;
                if (t1Arguments.Length == t2Arguments.Count)
                {
                    for (int i = 0; i < t1Arguments.Length; ++i)
                    {
                        if (!IsSimilarType(t1Arguments[i], t2Arguments[i]))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }

            // Find if matches for either t1 or t2 in matching table.
            Mono.Cecil.TypeReference match_t1 = null;
            try
            {
                match_t1 = matches_mono[t1];
            }
            catch
            {
            }

            // If entry for match for either, then the match has to match.
            if (match_t1 != null)
            {
                return(match_t1 == t2);
            }

            // Not matched before, so these match.
            matches_mono.Add(t1, t2);

            return(true);
        }
예제 #25
0
        public static bool IsSimilarType(Type thisType, Mono.Cecil.TypeReference type)
        {
            Mono.Cecil.TypeDefinition td = type.Resolve();

            // Ignore any 'ref' types
            if (thisType.IsByRef)
            {
                thisType = thisType.GetElementType();
            }
            if (type.IsByReference)
            {
                type = type.GetElementType();
            }

            // Handle array types
            if (thisType.IsArray && type.IsArray)
            {
                Mono.Cecil.ArrayType at = type as Mono.Cecil.ArrayType;
                // Dimensions must be the same.
                if (thisType.GetArrayRank() != at.Rank)
                {
                    return(false);
                }
                // Base type of array must be the same.
                return(IsSimilarType(thisType.GetElementType(), type.GetElementType()));
            }
            if (thisType.IsArray && !type.IsArray)
            {
                return(false);
            }
            if (type.IsArray && !thisType.IsArray)
            {
                return(false);
            }

            // If the types are identical, or they're both generic parameters
            // or the special 'T' type, treat as a match
            // Match also if thisType is generic and type can be unified with thisType.
            if (thisType.Name == type.Name || // identical types.
                ((thisType.IsGenericParameter || thisType == typeof(T)) && (type.IsGenericParameter || type.Name.Equals("T"))) || // using "T" as matching generic type.
                IsUnifiableMono(thisType, type))
            {
                return(true);
            }

            return(false);
        }
예제 #26
0
        IMethod GetNewForArray(object token)
        {
            IMethod __method = null;

            if (methodCache.TryGetValue(token.GetHashCode(), out __method))
            {
                return(__method);
            }
            Mono.Cecil.ModuleDefinition module = null;
            string typename = null;

            if (token is Mono.Cecil.TypeDefinition)
            {
                Mono.Cecil.TypeDefinition _def = (token as Mono.Cecil.TypeDefinition);
                module   = _def.Module;
                typename = _def.FullName;
            }
            else if (token is Mono.Cecil.TypeReference)
            {
                Mono.Cecil.TypeReference _ref = (token as Mono.Cecil.TypeReference);
                module   = _ref.Module;
                typename = _ref.FullName;
            }
            else
            {
                throw new NotImplementedException();
            }

            ICLRType _type  = null;
            ICLRType _Itype = GetType(typename);

            if (_Itype is ICLRType_Sharp)
            {
                _type = environment.GetType(typeof(CLRSharp.CLRSharp_Instance[]));
            }
            else
            {
                typename += "[]";
                //var _type = context.environment.GetType(typename, type.Module);
                _type = GetType(typename);
            }
            MethodParamList tlist = MethodParamList.const_OneParam_Int(environment);
            var             m     = _type.GetMethod(".ctor", tlist);

            methodCache[token.GetHashCode()] = m;
            return(m);
        }
예제 #27
0
 /// <summary>
 /// Converts a generic type description into a non-generic version
 /// </summary>
 /// <returns>The resolved type.</returns>
 /// <param name="ft">The type to resolve.</param>
 /// <param name="method">The method context, if any</param>
 public Mono.Cecil.TypeReference ResolveGenericType(Mono.Cecil.TypeReference ft, MethodState method = null)
 {
     if (ft != null)
     {
         if (ft.IsArray)
         {
             var elt = ft.GetElementType();
             if (elt.IsGenericParameter)
             {
                 return(Mono.Cecil.Rocks.TypeReferenceRocks.MakeArrayType(this.GenericTypes[elt.Name]));
             }
         }
         else if (ft.IsGenericParameter)
         {
             return(this.GenericTypes[ft.Name]);
         }
     }
     return(ft);
 }
예제 #28
0
        TypeInformation ParseTypeField(Mono.Cecil.TypeReference typeDefinition, Mono.Cecil.FieldDefinition fieldInfo, TypeAttribute inheritedAttribute, string parent = "")
        {
            var information = new TypeInformation(typeDefinition, fieldInfo, inheritedAttribute, parent);

            //blittable also contains bool, but does not contains enums
            if (fieldInfo.FieldType.IsBlittable())
            {
                return(information);
            }

            var fieldTypeDef = fieldInfo.FieldType.Resolve();

            if (fieldTypeDef.IsEnum)
            {
                return(information);
            }

            if (!fieldTypeDef.IsStruct())
            {
                return(default);
예제 #29
0
        public static GhostFieldAttribute GetGhostFieldAttribute(Mono.Cecil.TypeReference parentType,
                                                                 Mono.Cecil.FieldDefinition componentField)
        {
            var attribute = componentField.GetAttribute <GhostFieldAttribute>();

            if (attribute != null)
            {
                var fieldAttribute = new GhostFieldAttribute();
                if (attribute.HasProperties)
                {
                    foreach (var a in attribute.Properties)
                    {
                        typeof(GhostFieldAttribute).GetProperty(a.Name)?.SetValue(fieldAttribute, a.Argument.Value);
                    }
                }

                return(fieldAttribute);
            }

            return(default(GhostFieldAttribute));
        }
예제 #30
0
        public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext)
        {
            bool result = false;

            try {
                Navigator nav        = null;
                string    toTypeName = null;

                if (args.Length == 2)
                {
                    XPathNodeIterator it = (XPathNodeIterator)args[0];
                    if (it.MoveNext())
                    {
                        toTypeName = (string)args[1];
                        nav        = (Navigator)it.Current;
                    }
                }
                else
                {
                    toTypeName = (string)args[0];
                    nav        = (Navigator)docContext;
                }

                if (nav.Current is Mono.Cecil.TypeReference)
                {
                    Mono.Cecil.TypeReference reference = (Mono.Cecil.TypeReference)nav.Current;
                    Type fromType = Type.GetType(reference.FullName);
                    Type toType   = Type.GetType(toTypeName);

                    if (fromType != null && toType != null)
                    {
                        result = toType.IsAssignableFrom(fromType);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("CanCastTo function failed : \n" + e);
            }
            return(result);
        }
예제 #31
0
        ICLRType GetType(object token)
        {
            Mono.Cecil.ModuleDefinition module = null;
            string typename = null;

            if (token is Mono.Cecil.TypeDefinition)
            {
                Mono.Cecil.TypeDefinition _def = (token as Mono.Cecil.TypeDefinition);
                module   = _def.Module;
                typename = _def.FullName;
            }
            else if (token is Mono.Cecil.TypeReference)
            {
                Mono.Cecil.TypeReference _ref = (token as Mono.Cecil.TypeReference);
                module   = _ref.Module;
                typename = _ref.FullName;
            }
            else
            {
                throw new NotImplementedException();
            }
            return(GetType(typename, module));
        }
예제 #32
0
		protected abstract bool IsEnum (TType type, out bool isNativeEnum);
예제 #33
0
		protected abstract bool IsArray (TType type);
예제 #34
0
        public static ProductException CreateError(int code, Exception innerException, Mono.Cecil.TypeReference location, string message, params object[] args)
        {
            var e = new ProductException(code, true, innerException, message, args);

            if (location != null)
            {
                var td = location.Resolve();

                if (td.HasMethods)
                {
                    foreach (var method in td.Methods)
                    {
                        if (!method.IsConstructor)
                        {
                            continue;
                        }
                        SetLocation(e, method);
                        if (e.FileName != null)
                        {
                            break;
                        }
                    }
                }
            }
            return(e);
        }
예제 #35
0
		protected abstract string GetAssemblyQualifiedName (TType type);
예제 #36
0
		protected abstract ProtocolAttribute GetProtocolAttribute (TType type); // Return null if no attribute is found. Do not consider base types.
		protected abstract IEnumerable<ProtocolMemberAttribute> GetProtocolMemberAttributes (TType type); // Return null if no attributes found. Do not consider base types.
예제 #37
0
		string GetDescriptiveMethodName (TType type, TMethod method)
		{
			return GetTypeFullName (type) + "." + GetDescriptiveMethodName (method);
		}
예제 #38
0
		protected abstract bool IsInterface (TType type);
예제 #39
0
		protected abstract TType GetProtocolAttributeWrapperType (TType type); // Return null if no attribute is found. Do not consider base types.
예제 #40
0
		protected abstract bool VerifyIsConstrainedToNSObject (TType type, out TType constrained_type);
예제 #41
0
		protected abstract TType GetGenericTypeDefinition (TType type);
예제 #42
0
		protected abstract TType GetEnumUnderlyingType (TType type);
예제 #43
0
		protected abstract IEnumerable<TField> GetFields (TType type); // Must return all instance fields. May return static fields (they are filtered out automatically).
예제 #44
0
		protected abstract int GetValueTypeSize (TType type);
예제 #45
0
		protected abstract bool IsValueType (TType type);
예제 #46
0
		protected abstract bool IsCorlibType (TType type);
예제 #47
0
		protected abstract bool HasReleaseAttribute (TMethod method); // Returns true of the method's return type/value has a [Release] attribute.
		protected abstract bool IsINativeObject (TType type);
예제 #48
0
		protected abstract string GetTypeName (TType type);
예제 #49
0
		protected abstract IEnumerable<ProtocolMemberAttribute> GetProtocolMemberAttributes (TType type); // Return null if no attributes found. Do not consider base types.
		protected abstract List<AvailabilityBaseAttribute> GetAvailabilityAttributes (TType obj); // must only return attributes for the current platform.
예제 #50
0
		protected abstract ExportAttribute GetExportAttribute (TMethod method); // Return null if no attribute is found. Must check the base method (i.e. if method is overriding a method in a base class, must check the overridden method for the attribute).
		protected abstract Dictionary<TMethod, List<TMethod>> PrepareMethodMapping (TType type);
 private static void ConvertMethodDefinition(MethodReference method, TypeReference enumType)
 {
     if (method.ReturnType.FullName == SystemEnumName)
         method.ReturnType = enumType;
     foreach (var p in method.Parameters)
         if (p.ParameterType.FullName == SystemEnumName)
             p.ParameterType = enumType;
 }
예제 #52
0
		protected Exception CreateException (int code, TType type, string message, params object [] args)
		{
			return CreateException (code, null, type, message, args);
		}
예제 #53
0
		protected abstract RegisterAttribute GetRegisterAttribute (TType type); // Return null if no attribute is found. Do not consider base types.
		protected abstract CategoryAttribute GetCategoryAttribute (TType type); // Return null if no attribute is found. Do not consider base types.
예제 #54
0
		protected abstract bool IsGenericType (TType type);
예제 #55
0
		protected abstract RegisterAttribute GetRegisterAttribute (TType type); // Return null if no attribute is found. Do not consider base types.
예제 #56
0
 public CastExpression(IExpression expression, Mono.Cecil.TypeReference targetType)
 {
     _expression = expression;
     _targetType = targetType;
 }
예제 #57
0
		protected abstract bool TryGetAttribute (TType type, string attributeNamespace, string attributeType, out object attribute);
예제 #58
0
		protected abstract bool IsDelegate (TType type);
예제 #59
0
		bool IsEnum (TType type)
		{
			bool dummy;
			return IsEnum (type, out dummy);
		}
예제 #60
0
		protected abstract Exception CreateException (int code, Exception innerException, TType type, string message, params object [] args);