예제 #1
0
            internal override bool MatchGenericTypeEntry(GenericTypeEntry entry)
            {
                TypeSystemContext context = _typeToLookup.Context;

                DefType       parsedTypeDefinition = (DefType)context.ResolveRuntimeTypeHandle(entry._genericTypeDefinitionHandle);
                Instantiation parsedArgs           = context.ResolveRuntimeTypeHandles(entry._genericTypeArgumentHandles);
                DefType       parsedGenericType    = context.ResolveGenericInstantiation(parsedTypeDefinition, parsedArgs);

                return(parsedGenericType == _typeToLookup);
            }
        private TypeDesc GetInstantiationType(ref NativeParser parser, uint arity)
        {
            DefType typeDefinition = (DefType)GetType(ref parser);

            TypeDesc[] typeArguments = new TypeDesc[arity];
            for (uint i = 0; i < arity; i++)
            {
                typeArguments[i] = GetType(ref parser);
            }

            return(_typeSystemContext.ResolveGenericInstantiation(typeDefinition, new Instantiation(typeArguments)));
        }
예제 #3
0
            internal override bool MatchParsedEntry(RuntimeTypeHandle tentativeType)
            {
                //
                // Entries read from the hashtable are loaded as DefTypes, and compared to the input.
                // This lookup is slower than the lookups using RuntimeTypeHandles, but can handle cases where we don't have
                // RuntimeTypeHandle values for all of the components of the input DefType, but still need to look it up in case the type
                // statically exists and has an existing RuntimeTypeHandle value.
                //
                TypeSystemContext context = _typeToLookup.Context;

                RuntimeTypeHandle[] parsedArgsHandles;
                RuntimeTypeHandle   parsedTypeDefinitionHandle = RuntimeAugments.GetGenericInstantiation(tentativeType, out parsedArgsHandles);

                DefType       parsedTypeDefinition = (DefType)context.ResolveRuntimeTypeHandle(parsedTypeDefinitionHandle);
                Instantiation parsedArgs           = context.ResolveRuntimeTypeHandles(parsedArgsHandles);
                DefType       parsedGenericType    = context.ResolveGenericInstantiation(parsedTypeDefinition, parsedArgs);

                return(parsedGenericType == _typeToLookup);
            }