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

Made Compiler 'Caller' values work inside mixins

This commit is contained in:
Brian Fiete 2021-01-31 10:23:39 -08:00
parent 1519a60104
commit 8406e00a60
3 changed files with 52 additions and 0 deletions

View file

@ -6889,6 +6889,12 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
argValue = BfTypedValue(mModule->GetStringObjectValue(projectName),
mModule->ResolveTypeDef(mModule->mCompiler->mStringTypeDef));
}
else if (strcmp(globalVar->mName, "#ProjectName") == 0)
{
String projectName = methodInstance->mMethodDef->mDeclaringType->mProject->mName;
argValue = BfTypedValue(mModule->GetStringObjectValue(projectName),
mModule->ResolveTypeDef(mModule->mCompiler->mStringTypeDef));
}
else
{
argValue = mModule->GetCompilerFieldValue(globalVar->mName);
@ -15185,6 +15191,7 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
auto rootMethodState = mModule->mCurMethodState->GetRootMethodState();
BfMixinState* mixinState = rootMethodState->mMixinStates.Alloc();
mixinState->mInjectFilePosition = mModule->mCurFilePosition;
mixinState->mPrevMixinState = curMethodState->mMixinState;
mixinState->mLocalsStartIdx = (int)mModule->mCurMethodState->mLocals.size();
mixinState->mMixinMethodInstance = methodInstance;