| 1417 | } |
| 1418 | |
| 1419 | void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType, SizedArrayImpl<BfIRType>& paramTypes, bool forceStatic) |
| 1420 | { |
| 1421 | BfModule* resolveModule = module->mContext->mUnreifiedModule; |
| 1422 | |
| 1423 | resolveModule->PopulateType(mReturnType); |
| 1424 | |
| 1425 | BfTypeCode loweredReturnTypeCode = BfTypeCode_None; |
| 1426 | BfTypeCode loweredReturnTypeCode2 = BfTypeCode_None; |
| 1427 | if ((!module->mIsComptimeModule) && (GetLoweredReturnType(&loweredReturnTypeCode, &loweredReturnTypeCode2, forceStatic)) && (loweredReturnTypeCode != BfTypeCode_None)) |
| 1428 | { |
| 1429 | auto irReturnType = module->GetIRLoweredType(loweredReturnTypeCode, loweredReturnTypeCode2); |
| 1430 | returnType = irReturnType; |
| 1431 | } |
| 1432 | else if ((mReturnType->IsValuelessType()) || (mReturnType->IsVar())) |
| 1433 | { |
| 1434 | auto voidType = module->GetPrimitiveType(BfTypeCode_None); |
| 1435 | returnType = module->mBfIRBuilder->MapType(voidType); |
| 1436 | } |
| 1437 | else if ((!module->mIsComptimeModule) && (GetStructRetIdx(forceStatic) != -1)) |
| 1438 | { |
| 1439 | auto voidType = module->GetPrimitiveType(BfTypeCode_None); |
| 1440 | returnType = module->mBfIRBuilder->MapType(voidType); |
| 1441 | auto typeInst = mReturnType->ToTypeInstance(); |
| 1442 | if (typeInst != NULL) |
| 1443 | { |
| 1444 | paramTypes.push_back(module->mBfIRBuilder->MapTypeInstPtr(typeInst)); |
| 1445 | } |
| 1446 | else |
| 1447 | { |
| 1448 | auto ptrType = module->CreatePointerType(mReturnType); |
| 1449 | paramTypes.push_back(module->mBfIRBuilder->MapType(ptrType)); |
| 1450 | } |
| 1451 | } |
| 1452 | else |
| 1453 | { |
| 1454 | returnType = module->mBfIRBuilder->MapType(mReturnType); |
| 1455 | } |
| 1456 | |
| 1457 | for (int paramIdx = -1; paramIdx < GetParamCount(); paramIdx++) |
| 1458 | { |
| 1459 | BfType* checkType = NULL; |
| 1460 | if (paramIdx == -1) |
| 1461 | { |
| 1462 | if ((mMethodDef->mIsStatic) || (forceStatic)) |
| 1463 | continue; |
| 1464 | if (mIsClosure) |
| 1465 | { |
| 1466 | checkType = module->mCurMethodState->mClosureState->mClosureType; |
| 1467 | } |
| 1468 | else |
| 1469 | { |
| 1470 | if (HasExplicitThis()) |
| 1471 | checkType = GetParamType(0); |
| 1472 | else |
| 1473 | checkType = GetOwner(); |
| 1474 | } |
| 1475 | } |
| 1476 | else |
no test coverage detected