mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- better fix for the class type problem: We already know the wanted type so let's use that instead of trying to determine it from the actual name.
This commit is contained in:
parent
c2b37aeeea
commit
32d33618ea
2 changed files with 4 additions and 11 deletions
|
@ -6199,9 +6199,9 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
delete this;
|
||||
return x;
|
||||
}
|
||||
auto to = static_cast<PClassPointer *>(ValueType);
|
||||
if (basex->ValueType->GetClass() == RUNTIME_CLASS(PClassPointer))
|
||||
{
|
||||
auto to = static_cast<PClassPointer *>(ValueType);
|
||||
auto from = static_cast<PClassPointer *>(basex->ValueType);
|
||||
if (from->ClassRestriction->IsDescendantOf(to->ClassRestriction))
|
||||
{
|
||||
|
@ -6227,7 +6227,6 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
FName clsname = static_cast<FxConstant *>(basex)->GetValue().GetName();
|
||||
PClass *cls = NULL;
|
||||
FxExpression *x;
|
||||
|
||||
if (clsname != NAME_None)
|
||||
{
|
||||
|
@ -6250,12 +6249,8 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
|
|||
}
|
||||
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, to, ScriptPosition);
|
||||
delete this;
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -364,12 +364,10 @@ public:
|
|||
isresolved = true;
|
||||
}
|
||||
|
||||
FxConstant(PClass *val, const FScriptPosition &pos) : FxExpression(pos)
|
||||
FxConstant(PClass *val, PClassPointer *valtype, const FScriptPosition &pos) : FxExpression(pos)
|
||||
{
|
||||
value.pointer = (void*)val;
|
||||
if (val != nullptr) ValueType = NewClassPointer(val);
|
||||
else ValueType = NewClassPointer(RUNTIME_CLASS(DObject));
|
||||
value.Type = NewClassPointer(RUNTIME_CLASS(DObject));
|
||||
value.Type = ValueType = valtype;
|
||||
isresolved = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue