mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 04:51:41 +00:00
- block access to private and protected data for the external variabler getter functions.
- fixed: The state index comparison against 0 was broken. - fixed: Resolving codegen nodes must set the strictness flag per function so that ZSCRIPT and DECORATE are done properly.
This commit is contained in:
parent
514bcfb128
commit
76c34d7b2f
4 changed files with 7 additions and 4 deletions
|
@ -5031,7 +5031,7 @@ static PField *GetVar(DObject *self, FName varname)
|
|||
{
|
||||
PField *var = dyn_cast<PField>(self->GetClass()->Symbols.FindSymbol(varname, true));
|
||||
|
||||
if (var == NULL || (var->Flags & VARF_Native) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||
if (var == NULL || (var->Flags & (VARF_Native | VARF_Private | VARF_Protected | VARF_Static)) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||
{
|
||||
Printf("%s is not a user variable in class %s\n", varname.GetChars(),
|
||||
self->GetClass()->TypeName.GetChars());
|
||||
|
@ -5080,7 +5080,7 @@ static PField *GetArrayVar(DObject *self, FName varname, int pos)
|
|||
{
|
||||
PField *var = dyn_cast<PField>(self->GetClass()->Symbols.FindSymbol(varname, true));
|
||||
|
||||
if (var == NULL || (var->Flags & VARF_Native) ||
|
||||
if (var == NULL || (var->Flags & (VARF_Native | VARF_Private | VARF_Protected | VARF_Static)) ||
|
||||
!var->Type->IsKindOf(RUNTIME_CLASS(PArray)) ||
|
||||
!static_cast<PArray *>(var->Type)->ElementType->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||
{
|
||||
|
|
|
@ -1688,7 +1688,7 @@ static void SetMapThingUserData(AActor *actor, unsigned udi)
|
|||
|
||||
udi++;
|
||||
|
||||
if (var == NULL || (var->Flags & VARF_Native) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||
if (var == NULL || (var->Flags & (VARF_Native|VARF_Private|VARF_Protected|VARF_Static)) || !var->Type->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||
{
|
||||
DPrintf(DMSG_WARNING, "%s is not a user variable in class %s\n", varname.GetChars(),
|
||||
actor->GetClass()->TypeName.GetChars());
|
||||
|
|
|
@ -7886,7 +7886,7 @@ FxExpression *FxRuntimeStateIndex::Resolve(FCompileContext &ctx)
|
|||
delete this;
|
||||
return nullptr;
|
||||
}
|
||||
else if (Index->isConstant() && static_cast<FxConstant *>(Index) < 0)
|
||||
else if (Index->isConstant() && static_cast<FxConstant *>(Index)->GetValue() < 0)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "State index must be positive");
|
||||
delete this;
|
||||
|
|
|
@ -713,6 +713,7 @@ void FFunctionBuildList::Build()
|
|||
ctx.FunctionArgs.Push(local);
|
||||
}
|
||||
|
||||
FScriptPosition::StrictErrors = !item.FromDecorate;
|
||||
item.Code = item.Code->Resolve(ctx);
|
||||
item.Proto = ctx.ReturnProto;
|
||||
|
||||
|
@ -758,4 +759,6 @@ void FFunctionBuildList::Build()
|
|||
fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4);
|
||||
fclose(dump);
|
||||
}
|
||||
FScriptPosition::StrictErrors = false;
|
||||
|
||||
}
|
Loading…
Reference in a new issue