MCPcopy Create free account
hub / github.com/beefytech/Beef / GetParamType

Method GetParamType

IDEHelper/Compiler/BfResolvedTypeUtils.cpp:1224–1268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1222}
1223
1224BfType* 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
1270bool BfMethodInstance::GetParamIsSplat(int paramIdx)
1271{

Callers 15

AddDeferredCallEntryMethod · 0.45
CreateTypeDataMethod · 0.45
AllocFromTypeMethod · 0.45
GetMethodByNameMethod · 0.45
MethodToStringMethod · 0.45
GetCustomAttributesMethod · 0.45
TryConstCalcAppendMethod · 0.45

Calls 7

CreatePointerTypeMethod · 0.80
IsFunctionMethod · 0.45
IsValueTypeMethod · 0.45
GetLoweredTypeMethod · 0.45
IsTupleMethod · 0.45
GetUnderlyingTypeMethod · 0.45

Tested by

no test coverage detected