Exemplo n.º 1
0
        /// <summary>
        /// Ensures that all of the types that the method uses have been created so that when the methods is actually converted,
        /// no types have to be created.
        /// </summary>
        /// <param name="conversion"></param>
        /// <param name="boundTypeMask"></param>
        public void EnsureTypes(ILConversion conversion, SemanticTypeMask_I boundTypeMask)
        {
            if (!boundTypeMask.IsDefinition())
            {
                return;
            }

            var typeDefinitionMask = (BoundTypeDefinitionMask_I)boundTypeMask;

            var typeReference = typeDefinitionMask.SourceTypeReference;

            // Done on purpose to find errors
            var typeDefinition = Cecil.GetFundamentalTypeDefinition(typeReference);

            var methods = typeDefinition.Methods;

            for (int i = 0; i < methods.Count; i++)
            {
                var method = methods[i];
                EnsureTypes(conversion, method, typeReference);
            }
        }
Exemplo n.º 2
0
        public void EnsureTypes(ILConversion conversion, SemanticTypeMask_I boundTypeMask)
        {
            if (!boundTypeMask.IsDefinition())
            {
                return;
            }

            var typeDefinitionMask = (SemanticTypeDefinitionMask_I)boundTypeMask;

            var typeReference = typeDefinitionMask.SourceTypeReference;

            var typeDefinition = Cecil.GetFundamentalTypeDefinition(typeReference);

            var fields = typeDefinition.Fields;

            for (int i = 0; i < fields.Count; i++)
            {
                var field = fields[i];

                EnsureTypes(conversion, field, typeReference);
            }
        }