- native meta variables are not needed anymore. They were only a temporary aid to properly handle this, but now all have been redone.

This commit is contained in:
Christoph Oelckers 2017-02-28 14:38:50 +01:00
parent bc0ffc4185
commit 168627f549
3 changed files with 21 additions and 29 deletions

View file

@ -6871,7 +6871,7 @@ ExpEmit FxStructMember::Emit(VMFunctionBuilder *build)
{ {
obj.Free(build); obj.Free(build);
ExpEmit meta(build, REGT_POINTER); ExpEmit meta(build, REGT_POINTER);
build->Emit(membervar->Flags & VARF_Native? OP_CLSS : OP_META, meta.RegNum, obj.RegNum); build->Emit(OP_META, meta.RegNum, obj.RegNum);
obj = meta; obj = meta;
} }

View file

@ -826,16 +826,9 @@ static void DispatchScriptProperty(FScanner &sc, PProperty *prop, AActor *defaul
if (i > 0) sc.MustGetStringName(","); if (i > 0) sc.MustGetStringName(",");
if (f->Flags & VARF_Meta) if (f->Flags & VARF_Meta)
{
if (f->Flags & VARF_Native)
{
addr = ((char*)bag.Info) + f->Offset;
}
else
{ {
addr = ((char*)bag.Info->Meta) + f->Offset; addr = ((char*)bag.Info->Meta) + f->Offset;
} }
}
else else
{ {
addr = ((char*)defaults) + f->Offset; addr = ((char*)defaults) + f->Offset;

View file

@ -1095,8 +1095,13 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
if (varflags & VARF_Native) if (varflags & VARF_Native)
{ {
auto querytype = (varflags & VARF_Meta) ? type->GetClass() : type; if (varflags & VARF_Meta)
fd = FindField(querytype, FName(name->Name).GetChars()); {
Error(field, "Native meta variable %s not allowed", FName(name->Name).GetChars());
}
else
{
fd = FindField(type, FName(name->Name).GetChars());
if (fd == nullptr) if (fd == nullptr)
{ {
Error(field, "The member variable '%s.%s' has not been exported from the executable.", type->TypeName.GetChars(), FName(name->Name).GetChars()); Error(field, "The member variable '%s.%s' has not been exported from the executable.", type->TypeName.GetChars(), FName(name->Name).GetChars());
@ -1113,6 +1118,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
type->AddNativeField(name->Name, thisfieldtype, fd->FieldOffset, varflags, fd->BitValue); type->AddNativeField(name->Name, thisfieldtype, fd->FieldOffset, varflags, fd->BitValue);
} }
} }
}
else if (hasnativechildren) else if (hasnativechildren)
{ {
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars()); Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars());
@ -1693,16 +1699,9 @@ void ZCCCompiler::DispatchScriptProperty(PProperty *prop, ZCC_PropertyStmt *prop
void *addr; void *addr;
if (f->Flags & VARF_Meta) if (f->Flags & VARF_Meta)
{
if (f->Flags & VARF_Native)
{
addr = ((char*)bag.Info) + f->Offset;
}
else
{ {
addr = ((char*)bag.Info->Meta) + f->Offset; addr = ((char*)bag.Info->Meta) + f->Offset;
} }
}
else else
{ {
addr = ((char*)defaults) + f->Offset; addr = ((char*)defaults) + f->Offset;