mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Fixes for readonly
This commit is contained in:
parent
7e111329c7
commit
63ce6eb07b
1 changed files with 8 additions and 3 deletions
|
@ -3981,8 +3981,9 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
|
|
||||||
bool isTemporary = target.IsTempAddr();
|
bool isTemporary = target.IsTempAddr();
|
||||||
bool wantsLoadValue = false;
|
bool wantsLoadValue = false;
|
||||||
|
bool wantsReadOnly = false;
|
||||||
if ((field->mIsReadOnly) && ((mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Ctor) || (!target.IsThis())))
|
if ((field->mIsReadOnly) && ((mModule->mCurMethodInstance->mMethodDef->mMethodType != BfMethodType_Ctor) || (!target.IsThis())))
|
||||||
wantsLoadValue = true;
|
wantsReadOnly = true;
|
||||||
|
|
||||||
bool isComposite = target.mType->IsComposite();
|
bool isComposite = target.mType->IsComposite();
|
||||||
if ((isComposite) && (!target.mType->IsTypedPrimitive()) && (!target.IsAddr()))
|
if ((isComposite) && (!target.mType->IsTypedPrimitive()) && (!target.IsAddr()))
|
||||||
|
@ -4072,7 +4073,11 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
if (wantsLoadValue)
|
if (wantsLoadValue)
|
||||||
retVal = mModule->LoadValue(retVal, NULL, mIsVolatileReference);
|
retVal = mModule->LoadValue(retVal, NULL, mIsVolatileReference);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ((wantsReadOnly) && (retVal.IsAddr())&& (!retVal.IsReadOnly()))
|
||||||
|
retVal.mKind = BfTypedValueKind_ReadOnlyAddr;
|
||||||
mIsHeapReference = true;
|
mIsHeapReference = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (isTemporary)
|
if (isTemporary)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue