| 10570 | } |
| 10571 | |
| 10572 | CeTypeInfo* CeMachine::GetTypeInfo(BfType* type) |
| 10573 | { |
| 10574 | if (type == NULL) |
| 10575 | return NULL; |
| 10576 | |
| 10577 | auto typeInstance = type->ToTypeInstance(); |
| 10578 | if (typeInstance == NULL) |
| 10579 | return NULL; |
| 10580 | |
| 10581 | CeTypeInfo* ceTypeInfo = NULL; |
| 10582 | if (!mTypeInfoMap.TryAdd(type, NULL, &ceTypeInfo)) |
| 10583 | { |
| 10584 | if (ceTypeInfo->mRevision == typeInstance->mRevision) |
| 10585 | return ceTypeInfo; |
| 10586 | ceTypeInfo->mMethodInstances.Clear(); |
| 10587 | } |
| 10588 | |
| 10589 | mCeModule->PopulateType(typeInstance, BfPopulateType_DataAndMethods); |
| 10590 | ceTypeInfo->mRevision = typeInstance->mRevision; |
| 10591 | for (auto& methodGroup : typeInstance->mMethodInstanceGroups) |
| 10592 | { |
| 10593 | if (methodGroup.mOnDemandKind == BfMethodOnDemandKind_NoDecl_AwaitingReference) |
| 10594 | { |
| 10595 | auto methodDef = typeInstance->mTypeDef->mMethods[methodGroup.mMethodIdx]; |
| 10596 | auto flags = ((methodDef->mGenericParams.size() != 0) || (typeInstance->IsUnspecializedType())) ? BfGetMethodInstanceFlag_UnspecializedPass : BfGetMethodInstanceFlag_None; |
| 10597 | flags = (BfGetMethodInstanceFlags)(flags | BfGetMethodInstanceFlag_MethodInstanceOnly); |
| 10598 | mCeModule->GetMethodInstance(typeInstance, methodDef, BfTypeVector(), flags); |
| 10599 | } |
| 10600 | |
| 10601 | if (methodGroup.mDefault != NULL) |
| 10602 | { |
| 10603 | mMethodInstanceSet.Add(methodGroup.mDefault); |
| 10604 | ceTypeInfo->mMethodInstances.Add(methodGroup.mDefault); |
| 10605 | } |
| 10606 | if (methodGroup.mMethodSpecializationMap != NULL) |
| 10607 | { |
| 10608 | for (auto& kv : *methodGroup.mMethodSpecializationMap) |
| 10609 | { |
| 10610 | mMethodInstanceSet.Add(kv.mValue); |
| 10611 | ceTypeInfo->mMethodInstances.Add(kv.mValue); |
| 10612 | } |
| 10613 | } |
| 10614 | } |
| 10615 | return ceTypeInfo; |
| 10616 | } |
| 10617 | |
| 10618 | BfMethodInstance* CeMachine::GetMethodInstance(int64 methodHandle) |
| 10619 | { |
no test coverage detected