mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-17 09:42:04 +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));
|
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(),
|
Printf("%s is not a user variable in class %s\n", varname.GetChars(),
|
||||||
self->GetClass()->TypeName.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));
|
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)) ||
|
!var->Type->IsKindOf(RUNTIME_CLASS(PArray)) ||
|
||||||
!static_cast<PArray *>(var->Type)->ElementType->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
!static_cast<PArray *>(var->Type)->ElementType->IsKindOf(RUNTIME_CLASS(PBasicType)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ static void SetMapThingUserData(AActor *actor, unsigned udi)
|
||||||
|
|
||||||
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(),
|
DPrintf(DMSG_WARNING, "%s is not a user variable in class %s\n", varname.GetChars(),
|
||||||
actor->GetClass()->TypeName.GetChars());
|
actor->GetClass()->TypeName.GetChars());
|
||||||
|
|
|
@ -7886,7 +7886,7 @@ FxExpression *FxRuntimeStateIndex::Resolve(FCompileContext &ctx)
|
||||||
delete this;
|
delete this;
|
||||||
return nullptr;
|
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");
|
ScriptPosition.Message(MSG_ERROR, "State index must be positive");
|
||||||
delete this;
|
delete this;
|
||||||
|
|
|
@ -713,6 +713,7 @@ void FFunctionBuildList::Build()
|
||||||
ctx.FunctionArgs.Push(local);
|
ctx.FunctionArgs.Push(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FScriptPosition::StrictErrors = !item.FromDecorate;
|
||||||
item.Code = item.Code->Resolve(ctx);
|
item.Code = item.Code->Resolve(ctx);
|
||||||
item.Proto = ctx.ReturnProto;
|
item.Proto = ctx.ReturnProto;
|
||||||
|
|
||||||
|
@ -758,4 +759,6 @@ void FFunctionBuildList::Build()
|
||||||
fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4);
|
fprintf(dump, "\n*************************************************************************\n%i code bytes\n", codesize * 4);
|
||||||
fclose(dump);
|
fclose(dump);
|
||||||
}
|
}
|
||||||
|
FScriptPosition::StrictErrors = false;
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue