- fixed: FxClassTypeCast must use FindClassTentative to get the class type.

This function may well be invoked before a class is actually defined, so it needs to create a placeholder to be filled in later.
This commit is contained in:
Christoph Oelckers 2016-02-09 11:51:19 +01:00
parent 1ca2293983
commit 8823b60c0d
2 changed files with 5 additions and 5 deletions

View file

@ -913,12 +913,12 @@ public:
class FxClassTypeCast : public FxExpression
{
const PClass *desttype;
PClass *desttype;
FxExpression *basex;
public:
FxClassTypeCast(const PClass *dtype, FxExpression *x);
FxClassTypeCast(PClass *dtype, FxExpression *x);
~FxClassTypeCast();
FxExpression *Resolve(FCompileContext&);
ExpEmit Emit(VMFunctionBuilder *build);

View file

@ -3503,7 +3503,7 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build, bool tailcall)
//
//==========================================================================
FxClassTypeCast::FxClassTypeCast(const PClass *dtype, FxExpression *x)
FxClassTypeCast::FxClassTypeCast(PClass *dtype, FxExpression *x)
: FxExpression(x->ScriptPosition)
{
desttype = dtype;
@ -3542,11 +3542,11 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
if (basex->isConstant())
{
FName clsname = static_cast<FxConstant *>(basex)->GetValue().GetName();
const PClass *cls = NULL;
PClass *cls = NULL;
if (clsname != NAME_None)
{
cls = PClass::FindClass(clsname);
cls = desttype->FindClassTentative(clsname);
if (cls == NULL)
{
/* lax */