mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Propagating readonly with mixin arguments
This commit is contained in:
parent
768cae659c
commit
bdc6a17f79
1 changed files with 12 additions and 1 deletions
|
@ -13837,6 +13837,8 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
|
||||||
|
|
||||||
localVar->mIsReadOnly = argValue.IsReadOnly();
|
localVar->mIsReadOnly = argValue.IsReadOnly();
|
||||||
}
|
}
|
||||||
|
if (argValue.IsReadOnly())
|
||||||
|
localVar->mIsReadOnly = true;
|
||||||
|
|
||||||
if (argIdx == -1)
|
if (argIdx == -1)
|
||||||
{
|
{
|
||||||
|
@ -15041,6 +15043,12 @@ BfTypedValue BfExprEvaluator::GetResult(bool clearResult, bool resolveGenericTyp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mResultFieldInstance != NULL)
|
||||||
|
{
|
||||||
|
NOP;
|
||||||
|
}
|
||||||
|
|
||||||
mPropDef = NULL;
|
mPropDef = NULL;
|
||||||
mPropDefBypassVirtual = false;
|
mPropDefBypassVirtual = false;
|
||||||
mIndexerValues.clear();
|
mIndexerValues.clear();
|
||||||
|
@ -15354,7 +15362,10 @@ bool BfExprEvaluator::CheckModifyResult(BfTypedValue typedVal, BfAstNode* refNod
|
||||||
{
|
{
|
||||||
if (!mModule->mCurMethodInstance->IsMixin())
|
if (!mModule->mCurMethodInstance->IsMixin())
|
||||||
{
|
{
|
||||||
if ((localVar->mResolvedType->IsGenericParam()) && (onlyNeedsMut))
|
if (mModule->mCurMethodState->mMixinState != NULL)
|
||||||
|
error = mModule->Fail(StrFormat("Cannot %s mixin parameter '%s'", modifyType,
|
||||||
|
localVar->mName.c_str(), mModule->MethodToString(mModule->mCurMethodInstance).c_str()), refNode);
|
||||||
|
else if ((localVar->mResolvedType->IsGenericParam()) && (onlyNeedsMut))
|
||||||
error = mModule->Fail(StrFormat("Cannot %s parameter '%s'. Consider adding 'mut' or 'ref' specifier to parameter or copying to a local variable.", modifyType,
|
error = mModule->Fail(StrFormat("Cannot %s parameter '%s'. Consider adding 'mut' or 'ref' specifier to parameter or copying to a local variable.", modifyType,
|
||||||
localVar->mName.c_str(), mModule->MethodToString(mModule->mCurMethodInstance).c_str()), refNode);
|
localVar->mName.c_str(), mModule->MethodToString(mModule->mCurMethodInstance).c_str()), refNode);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue