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

Method FixValues

IDEHelper/Backend/BeIRCodeGen.cpp:406–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406void BeIRCodeGen::FixValues(BeStructType* structType, CmdParamVec<BeValue*>& values)
407{
408 if (values.size() >= structType->mMembers.size())
409 return;
410
411 int readIdx = values.size() - 1;
412 values.resize(structType->mMembers.size());
413 for (int i = (int)values.size() - 1; i >= 0; i--)
414 {
415 if (mBeContext->AreTypesEqual(values[readIdx]->GetType(), structType->mMembers[i].mType))
416 {
417 values[i] = values[readIdx];
418 readIdx--;
419 }
420 else if (structType->mMembers[i].mType->IsSizedArray())
421 {
422 auto beConst = mBeModule->mAlloc.Alloc<BeConstant>();
423 beConst->mType = structType->mMembers[i].mType;
424 values[i] = beConst;
425 }
426 else
427 {
428 FatalError("Malformed structure values");
429 }
430 }
431}
432
433void BeIRCodeGen::FixValues(BeStructType* structType, SizedArrayImpl<BeConstant*>& values)
434{

Callers

nothing calls this directly

Calls 5

AreTypesEqualMethod · 0.80
sizeMethod · 0.45
resizeMethod · 0.45
GetTypeMethod · 0.45
IsSizedArrayMethod · 0.45

Tested by

no test coverage detected