diff options
Diffstat (limited to 'src/vm/typedesc.inl')
-rw-r--r-- | src/vm/typedesc.inl | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/vm/typedesc.inl b/src/vm/typedesc.inl new file mode 100644 index 0000000000..4d7416ebf8 --- /dev/null +++ b/src/vm/typedesc.inl @@ -0,0 +1,70 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +// +// File: typedesc.inl +// + + +// + +// +// ============================================================================ + + +#ifndef _TYPEDESC_INL_ +#define _TYPEDESC_INL_ + +inline PTR_MethodTable TypeDesc::GetMethodTable() { + + LIMITED_METHOD_DAC_CONTRACT; + + if (IsGenericVariable()) + return NULL; + + if (GetInternalCorElementType() == ELEMENT_TYPE_FNPTR) + return MscorlibBinder::GetElementType(ELEMENT_TYPE_U); + + _ASSERTE(HasTypeParam()); + ParamTypeDesc* asParam = dac_cast<PTR_ParamTypeDesc>(this); + + if (GetInternalCorElementType() == ELEMENT_TYPE_VALUETYPE) + return dac_cast<PTR_MethodTable>(asParam->m_Arg.AsMethodTable()); + else + return(asParam->m_TemplateMT.GetValue()); +} + +inline TypeHandle TypeDesc::GetTypeParam() { + LIMITED_METHOD_DAC_CONTRACT; + + if (IsGenericVariable() || IsFnPtr()) + return TypeHandle(); + + _ASSERTE(HasTypeParam()); + ParamTypeDesc* asParam = dac_cast<PTR_ParamTypeDesc>(this); + return(asParam->m_Arg); +} + +inline TypeHandle ParamTypeDesc::GetTypeParam() { + LIMITED_METHOD_DAC_CONTRACT; + + return(this->m_Arg); +} + +inline Instantiation TypeDesc::GetClassOrArrayInstantiation() { + LIMITED_METHOD_DAC_CONTRACT; + + if (GetInternalCorElementType() != ELEMENT_TYPE_FNPTR) + { + ParamTypeDesc* asParam = dac_cast<PTR_ParamTypeDesc>(this); + return Instantiation(&asParam->m_Arg, 1); + } + else + return Instantiation(); +} + + +#endif // _TYPEDESC_INL_ + + + |