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

Made $alias$ work for splat parameters to mixins

This commit is contained in:
Brian Fiete 2020-01-22 12:37:44 -08:00
parent 004d5d8d1c
commit 70e751e718
11 changed files with 228 additions and 92 deletions

View file

@ -12653,18 +12653,26 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
{
if (localVar == newLocalVar)
continue;
if (newLocalVar->mValue != localVar->mValue)
if (!localVar->mIsSplat)
continue;
if (newLocalVar->mValue != localVar->mAddr)
continue;
String name = newLocalVar->mName;
String name = "$";
name += newLocalVar->mName;
name += "$alias$";
name += localVar->mName;
auto fakeValue = mModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, 0);
auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_Int32));
auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
newLocalVar->mName, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
mModule->mBfIRBuilder->DbgInsertValueIntrinsic(fakeValue, diVariable);
// auto fakeValue = mModule->mBfIRBuilder->CreateConst(BfTypeCode_Int32, 0);
// auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_Int32));
// auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
// name, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
// mModule->mBfIRBuilder->DbgInsertValueIntrinsic(fakeValue, diVariable);
auto diType = mModule->mBfIRBuilder->DbgGetType(mModule->GetPrimitiveType(BfTypeCode_NullPtr));
auto diVariable = mModule->mBfIRBuilder->DbgCreateAutoVariable(mModule->mCurMethodState->mCurScope->mDIScope,
name, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
mModule->mBfIRBuilder->DbgInsertValueIntrinsic(mModule->mBfIRBuilder->CreateConstNull(), diVariable);
found = true;
break;