| 1222 | } |
| 1223 | |
| 1224 | BfType* BfMethodInstance::GetParamType(int paramIdx, bool returnUnderlyingParamsType) |
| 1225 | { |
| 1226 | if (paramIdx == -1) |
| 1227 | { |
| 1228 | if ((mMethodInfoEx != NULL) && (mMethodInfoEx->mClosureInstanceInfo != NULL) && (mMethodInfoEx->mClosureInstanceInfo->mThisOverride != NULL)) |
| 1229 | return mMethodInfoEx->mClosureInstanceInfo->mThisOverride; |
| 1230 | BF_ASSERT(!mMethodDef->mIsStatic); |
| 1231 | auto owner = mMethodInstanceGroup->mOwner; |
| 1232 | BfType* thisType = owner; |
| 1233 | if (owner->IsFunction()) |
| 1234 | { |
| 1235 | BF_FATAL("Wrong 'this' index"); |
| 1236 | } |
| 1237 | if ((thisType->IsValueType()) && ((mMethodDef->mIsMutating) || (!AllowsSplatting(paramIdx))) && (!thisType->GetLoweredType(BfTypeUsage_Parameter))) |
| 1238 | return owner->mModule->CreatePointerType(thisType); |
| 1239 | return thisType; |
| 1240 | } |
| 1241 | |
| 1242 | BfMethodParam* methodParam = &mParams[paramIdx]; |
| 1243 | if (methodParam->mDelegateParamIdx != -1) |
| 1244 | { |
| 1245 | if (methodParam->mResolvedType->IsTuple()) |
| 1246 | { |
| 1247 | auto tupleType = (BfTupleType*)methodParam->mResolvedType; |
| 1248 | return tupleType->mFieldInstances[methodParam->mDelegateParamIdx].mResolvedType; |
| 1249 | } |
| 1250 | |
| 1251 | BfMethodInstance* invokeMethodInstance = methodParam->GetDelegateParamInvoke(); |
| 1252 | return invokeMethodInstance->GetParamType(methodParam->mDelegateParamIdx, true); |
| 1253 | } |
| 1254 | |
| 1255 | if (returnUnderlyingParamsType) |
| 1256 | { |
| 1257 | BfParameterDef* paramDef = mMethodDef->mParams[methodParam->mParamDefIdx]; |
| 1258 | if (paramDef->mParamKind == BfParamKind_Params) |
| 1259 | { |
| 1260 | auto underlyingType = methodParam->mResolvedType->GetUnderlyingType(); |
| 1261 | if (underlyingType != NULL) |
| 1262 | return underlyingType; |
| 1263 | return methodParam->mResolvedType; |
| 1264 | } |
| 1265 | } |
| 1266 | |
| 1267 | return methodParam->mResolvedType; |
| 1268 | } |
| 1269 | |
| 1270 | bool BfMethodInstance::GetParamIsSplat(int paramIdx) |
| 1271 | { |
no test coverage detected