1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Mixin name uniquing, 'this' for mixins

This commit is contained in:
Brian Fiete 2020-06-20 17:25:37 -07:00
parent 1a17780847
commit 4d53f185d8
8 changed files with 180 additions and 93 deletions

View file

@ -2693,38 +2693,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
if (methodDef->mIsOverride)
continue;
llvm::SmallVector<BfIRMDNode, 8> diParams;
diParams.push_back(DbgGetType(methodInstance->mReturnType));
BfType* thisType = NULL;
if (!methodDef->mIsStatic)
{
BfType* thisType;
thisType = typeInstance;
if (!thisType->IsValuelessType())
{
BfType* thisPtrType = thisType;
auto diType = DbgGetType(thisPtrType);
if ((thisType->IsComposite()) && (!methodInstance->GetParamIsSplat(-1)))
{
diType = DbgCreatePointerType(diType);
diType = DbgCreateArtificialType(diType);
}
diParams.push_back(diType);
}
}
for (int paramIdx = 0; paramIdx < methodInstance->GetParamCount(); paramIdx++)
{
bool isParamSkipped = methodInstance->IsParamSkipped(paramIdx);
if (!isParamSkipped)
{
auto resolvedType = methodInstance->GetParamType(paramIdx);
diParams.push_back(DbgGetType(resolvedType));
}
}
BfIRMDNode diFuncType = DbgCreateSubroutineType(diParams);
BfIRMDNode diFuncType = DbgCreateSubroutineType(methodInstance);
int defLine = 0;
@ -5004,6 +4973,45 @@ BfIRMDNode BfIRBuilder::DbgCreateParameterVariable(BfIRMDNode scope, const Strin
return retVal;
}
BfIRMDNode BfIRBuilder::DbgCreateSubroutineType(BfMethodInstance* methodInstance)
{
auto methodDef = methodInstance->mMethodDef;
auto typeInstance = methodInstance->GetOwner();
llvm::SmallVector<BfIRMDNode, 8> diParams;
diParams.push_back(DbgGetType(methodInstance->mReturnType));
BfType* thisType = NULL;
if (!methodDef->mIsStatic)
{
BfType* thisType;
thisType = typeInstance;
if (!thisType->IsValuelessType())
{
BfType* thisPtrType = thisType;
auto diType = DbgGetType(thisPtrType);
if ((thisType->IsComposite()) && (!methodInstance->GetParamIsSplat(-1)))
{
diType = DbgCreatePointerType(diType);
diType = DbgCreateArtificialType(diType);
}
diParams.push_back(diType);
}
}
for (int paramIdx = 0; paramIdx < methodInstance->GetParamCount(); paramIdx++)
{
bool isParamSkipped = methodInstance->IsParamSkipped(paramIdx);
if (!isParamSkipped)
{
auto resolvedType = methodInstance->GetParamType(paramIdx);
diParams.push_back(DbgGetType(resolvedType));
}
}
return DbgCreateSubroutineType(diParams);
}
BfIRMDNode BfIRBuilder::DbgCreateSubroutineType(const BfSizedArray<BfIRMDNode>& elements)
{
BfIRMDNode retVal = WriteCmd(BfIRCmd_DbgCreateSubroutineType, elements);