@@ -3253,54 +3253,7 @@ bool CLR_RT_ExecutionEngine::IsInstanceOfToken(
32533253 }
32543254
32553255 // Delegate to the CLR built-in type-compatibility test
3256- return TypeDescriptorsMatch (expectedDesc, actualDesc);
3257- }
3258-
3259- bool CLR_RT_ExecutionEngine::TypeDescriptorsMatch (const CLR_RT_TypeDescriptor &exp, const CLR_RT_TypeDescriptor &act)
3260- {
3261- // Quick check on the raw element kind
3262- if (exp.GetDataType () != act.GetDataType ())
3263- {
3264- return false ;
3265- }
3266-
3267- switch (exp.GetDataType ())
3268- {
3269- // Closed‐generic instantiation: compare the TypeSpec head
3270- case DATATYPE_GENERICINST:
3271- case DATATYPE_VAR:
3272- {
3273- auto &eSpec = exp.m_handlerGenericType ;
3274- auto &aSpec = act.m_handlerGenericType ;
3275- return eSpec.Assembly () == aSpec.Assembly () && eSpec.typeDefIndex == aSpec.typeDefIndex ;
3276- }
3277-
3278- // Plain object or value‐type: compare the TypeDef_Index
3279- case DATATYPE_CLASS:
3280- case DATATYPE_VALUETYPE:
3281- case DATATYPE_SZARRAY:
3282- {
3283- auto &eCls = exp.m_handlerCls ;
3284- auto &aCls = act.m_handlerCls ;
3285-
3286- if (eCls.data != aCls.data )
3287- {
3288- return false ;
3289- }
3290-
3291- // for array we may need to compare element‐types
3292- if (exp.GetDataType () == DATATYPE_SZARRAY)
3293- {
3294- // recurse into element descriptors
3295- return TypeDescriptorsMatch (exp, act);
3296- }
3297- return true ;
3298- }
3299-
3300- // All the primitives (I4, I8, R4, etc.) don't carry extra metadata
3301- default :
3302- return true ;
3303- }
3256+ return CLR_RT_HeapBlock::TypeDescriptorsMatch (expectedDesc, actualDesc);
33043257}
33053258
33063259HRESULT CLR_RT_ExecutionEngine::CastToType (
0 commit comments