mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 08:31:23 +00:00
- fixed a conversion warning with the pointer-type AActor fields.
- added master and tracer to the list of exported variables. - fixed: 'none' as class type must map to the real null pointer so that it won't get rejected by the stricter type checks. - added handling for member function calls to zcc_compile.cpp. - fixed: FxMemberFunctionCall may not delete the self expression if it gets passed on to the actual function call.
This commit is contained in:
parent
37914223f0
commit
c2b37aeeea
5 changed files with 17 additions and 3 deletions
|
@ -574,7 +574,7 @@ class PField : public PSymbol
|
||||||
public:
|
public:
|
||||||
PField(FName name, PType *type) : PSymbol(name), Offset(0), Type(type), Flags(0) {}
|
PField(FName name, PType *type) : PSymbol(name), Offset(0), Type(type), Flags(0) {}
|
||||||
PField(FName name, PType *type, DWORD flags) : PSymbol(name), Offset(0), Type(type), Flags(flags) {}
|
PField(FName name, PType *type, DWORD flags) : PSymbol(name), Offset(0), Type(type), Flags(flags) {}
|
||||||
PField(FName name, PType *type, DWORD flags, unsigned offset) : PSymbol(name), Offset(offset), Type(type), Flags(flags) {}
|
PField(FName name, PType *type, DWORD flags, size_t offset) : PSymbol(name), Offset(unsigned(offset)), Type(type), Flags(flags) {}
|
||||||
|
|
||||||
unsigned int Offset;
|
unsigned int Offset;
|
||||||
PType *Type;
|
PType *Type;
|
||||||
|
|
|
@ -437,6 +437,8 @@ xx(ScaleX)
|
||||||
xx(ScaleY)
|
xx(ScaleY)
|
||||||
xx(Floatbobphase)
|
xx(Floatbobphase)
|
||||||
xx(Target)
|
xx(Target)
|
||||||
|
xx(Master)
|
||||||
|
xx(Tracer)
|
||||||
|
|
||||||
xx(Blocking)
|
xx(Blocking)
|
||||||
xx(Blockmonsters)
|
xx(Blockmonsters)
|
||||||
|
|
|
@ -4975,6 +4975,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
||||||
auto self = !(afd->Variants[0].Flags & VARF_Static) ? Self : nullptr;
|
auto self = !(afd->Variants[0].Flags & VARF_Static) ? Self : nullptr;
|
||||||
auto x = new FxVMFunctionCall(self, afd, ArgList, ScriptPosition, staticonly);
|
auto x = new FxVMFunctionCall(self, afd, ArgList, ScriptPosition, staticonly);
|
||||||
ArgList = nullptr;
|
ArgList = nullptr;
|
||||||
|
if (Self == self) Self = nullptr;
|
||||||
delete this;
|
delete this;
|
||||||
return x->Resolve(ctx);
|
return x->Resolve(ctx);
|
||||||
}
|
}
|
||||||
|
@ -6226,6 +6227,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
||||||
{
|
{
|
||||||
FName clsname = static_cast<FxConstant *>(basex)->GetValue().GetName();
|
FName clsname = static_cast<FxConstant *>(basex)->GetValue().GetName();
|
||||||
PClass *cls = NULL;
|
PClass *cls = NULL;
|
||||||
|
FxExpression *x;
|
||||||
|
|
||||||
if (clsname != NAME_None)
|
if (clsname != NAME_None)
|
||||||
{
|
{
|
||||||
|
@ -6248,8 +6250,12 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
||||||
}
|
}
|
||||||
ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars());
|
ScriptPosition.Message(MSG_DEBUG, "resolving '%s' as class name", clsname.GetChars());
|
||||||
}
|
}
|
||||||
|
x = new FxConstant(cls, ScriptPosition);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = new FxConstant(ScriptPosition); // create a genuine null pointer to get past the type checks.
|
||||||
}
|
}
|
||||||
FxExpression *x = new FxConstant(cls, ScriptPosition);
|
|
||||||
delete this;
|
delete this;
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
|
@ -677,4 +677,6 @@ void InitThingdef()
|
||||||
symt.AddSymbol(new PField(NAME_VisibleEndAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndAngle)));
|
symt.AddSymbol(new PField(NAME_VisibleEndAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndAngle)));
|
||||||
symt.AddSymbol(new PField(NAME_VisibleEndPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndPitch)));
|
symt.AddSymbol(new PField(NAME_VisibleEndPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndPitch)));
|
||||||
symt.AddSymbol(new PField(NAME_Target, TypeActor, VARF_Native, myoffsetof(AActor, target)));
|
symt.AddSymbol(new PField(NAME_Target, TypeActor, VARF_Native, myoffsetof(AActor, target)));
|
||||||
|
symt.AddSymbol(new PField(NAME_Master, TypeActor, VARF_Native, myoffsetof(AActor, master)));
|
||||||
|
symt.AddSymbol(new PField(NAME_Tracer, TypeActor, VARF_Native, myoffsetof(AActor, tracer)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2381,7 +2381,11 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
||||||
return new FxFunctionCall(static_cast<ZCC_ExprID *>(fcall->Function)->Identifier, NAME_None, ConvertNodeList(fcall->Parameters), *ast);
|
return new FxFunctionCall(static_cast<ZCC_ExprID *>(fcall->Function)->Identifier, NAME_None, ConvertNodeList(fcall->Parameters), *ast);
|
||||||
|
|
||||||
case AST_ExprMemberAccess:
|
case AST_ExprMemberAccess:
|
||||||
break;
|
{
|
||||||
|
auto ema = static_cast<ZCC_ExprMemberAccess *>(fcall->Function);
|
||||||
|
Printf("Member call to %s\n", FName(ema->Right).GetChars());
|
||||||
|
return new FxMemberFunctionCall(ConvertNode(ema->Left), ema->Right, ConvertNodeList(fcall->Parameters), *ast);
|
||||||
|
}
|
||||||
|
|
||||||
case AST_ExprBinary:
|
case AST_ExprBinary:
|
||||||
// Array syntax for randoms. They are internally stored as ExprBinary with both an identifier on the left and right side.
|
// Array syntax for randoms. They are internally stored as ExprBinary with both an identifier on the left and right side.
|
||||||
|
|
Loading…
Reference in a new issue