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

Method GetGenericParamType

IDEHelper/Compiler/BfModule.cpp:9229–9256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9227}
9228
9229BfGenericParamType* BfModule::GetGenericParamType(BfGenericParamKind paramKind, int paramIdx)
9230{
9231 if (paramIdx < (int)mContext->mGenericParamTypes[paramKind].size())
9232 {
9233 auto genericParamType = mContext->mGenericParamTypes[paramKind][paramIdx];
9234 return genericParamType;
9235 }
9236
9237 auto genericParamType = new BfGenericParamType();
9238
9239 genericParamType->mContext = mContext;
9240 genericParamType->mGenericParamKind = paramKind;
9241 genericParamType->mGenericParamIdx = paramIdx;
9242
9243 PopulateType(genericParamType);
9244
9245 BF_ASSERT(paramIdx == (int)mContext->mGenericParamTypes[paramKind].size());
9246 mContext->mGenericParamTypes[paramKind].push_back(genericParamType);
9247
9248 BfResolvedTypeSet::LookupContext lookupCtx;
9249 lookupCtx.mModule = this;
9250 BfResolvedTypeSet::EntryRef typeEntry;
9251 auto inserted = mContext->mResolvedTypes.Insert(genericParamType, &lookupCtx, &typeEntry);
9252 BF_ASSERT(inserted);
9253 typeEntry->mValue = genericParamType;
9254
9255 return genericParamType;
9256}
9257
9258static int sValueFromExprIdx = 0;
9259

Callers 1

Calls 3

sizeMethod · 0.45
push_backMethod · 0.45
InsertMethod · 0.45

Tested by

no test coverage detected