mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
rename CheckWritable to IsWritable, and invert its output since it's always negated
This commit is contained in:
parent
da06212134
commit
d4e9438273
2 changed files with 7 additions and 10 deletions
|
@ -177,12 +177,9 @@ void FCompileContext::CheckReturn(PPrototype *proto, FScriptPosition &pos)
|
|||
}
|
||||
}
|
||||
|
||||
// [ZZ] I find it really dumb that something called CheckReadOnly returns false for readonly. renamed.
|
||||
bool FCompileContext::CheckWritable(int flags)
|
||||
bool FCompileContext::IsWritable(int flags)
|
||||
{
|
||||
if (!(flags & VARF_ReadOnly)) return false;
|
||||
if (!(flags & VARF_InternalAccess)) return true;
|
||||
return fileSystem.GetFileContainer(Lump) != 0;
|
||||
return !(flags & VARF_ReadOnly) || ((flags & VARF_InternalAccess) && fileSystem.GetFileContainer(Lump) == 0);
|
||||
}
|
||||
|
||||
FxLocalVariableDeclaration *FCompileContext::FindLocalVariable(FName name)
|
||||
|
@ -6730,7 +6727,7 @@ FxExpression *FxLocalVariable::Resolve(FCompileContext &ctx)
|
|||
bool FxLocalVariable::RequestAddress(FCompileContext &ctx, bool *writable)
|
||||
{
|
||||
AddressRequested = true;
|
||||
if (writable != nullptr) *writable = !ctx.CheckWritable(Variable->VarFlags);
|
||||
if (writable != nullptr) *writable = ctx.IsWritable(Variable->VarFlags);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6885,7 +6882,7 @@ FxGlobalVariable::FxGlobalVariable(PField* mem, const FScriptPosition &pos)
|
|||
bool FxGlobalVariable::RequestAddress(FCompileContext &ctx, bool *writable)
|
||||
{
|
||||
AddressRequested = true;
|
||||
if (writable != nullptr) *writable = AddressWritable && !ctx.CheckWritable(membervar->Flags);
|
||||
if (writable != nullptr) *writable = AddressWritable && ctx.IsWritable(membervar->Flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7078,7 +7075,7 @@ FxStackVariable::~FxStackVariable()
|
|||
bool FxStackVariable::RequestAddress(FCompileContext &ctx, bool *writable)
|
||||
{
|
||||
AddressRequested = true;
|
||||
if (writable != nullptr) *writable = AddressWritable && !ctx.CheckWritable(membervar->Flags);
|
||||
if (writable != nullptr) *writable = AddressWritable && ctx.IsWritable(membervar->Flags);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7180,7 +7177,7 @@ bool FxStructMember::RequestAddress(FCompileContext &ctx, bool *writable)
|
|||
else if (writable != nullptr)
|
||||
{
|
||||
// [ZZ] original check.
|
||||
bool bWritable = (AddressWritable && !ctx.CheckWritable(membervar->Flags) &&
|
||||
bool bWritable = (AddressWritable && ctx.IsWritable(membervar->Flags) &&
|
||||
(!classx->ValueType->isPointer() || !classx->ValueType->toPointer()->IsConst));
|
||||
// [ZZ] implement write barrier between different scopes
|
||||
if (bWritable)
|
||||
|
|
|
@ -101,7 +101,7 @@ struct FCompileContext
|
|||
|
||||
void HandleJumps(int token, FxExpression *handler);
|
||||
void CheckReturn(PPrototype *proto, FScriptPosition &pos);
|
||||
bool CheckWritable(int flags);
|
||||
bool IsWritable(int flags);
|
||||
FxLocalVariableDeclaration *FindLocalVariable(FName name);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue