mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 07:22:05 +00:00
const method cannot write to self
This commit is contained in:
parent
338e676e73
commit
195ae24dcb
1 changed files with 8 additions and 2 deletions
|
@ -6709,8 +6709,14 @@ bool FxStructMember::RequestAddress(FCompileContext &ctx, bool *writable)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AddressRequested = true;
|
AddressRequested = true;
|
||||||
if (writable != nullptr) *writable = (AddressWritable && !ctx.CheckWritable(membervar->Flags) &&
|
if (writable != nullptr)
|
||||||
(!classx->ValueType->IsKindOf(RUNTIME_CLASS(PPointer)) || !static_cast<PPointer*>(classx->ValueType)->IsConst));
|
{
|
||||||
|
*writable = (AddressWritable && !ctx.CheckWritable(membervar->Flags) &&
|
||||||
|
(!classx->ValueType->IsKindOf(RUNTIME_CLASS(PPointer)) || !static_cast<PPointer*>(classx->ValueType)->IsConst));
|
||||||
|
// [ZZ] self in a const function is not writable.
|
||||||
|
if ((classx->ExprType == EFX_Self) && (ctx.Function && (ctx.Function->Variants[0].Flags & VARF_ReadOnly)))
|
||||||
|
*writable = false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue