- added readonly pointers. They need to be defined with 'readonly<classtype>'. These are significantly different from declaring a field readonly in that they do not disallow modification of the variable itself but what it points to. For the actor defaults this is necessary to prevent accidental modification. A readonly pointer is actually a different type than a regular pointer.

- fixed code generation for dynamic cast. It was missing the jump instruction after the compare.
This commit is contained in:
Christoph Oelckers 2016-11-05 13:51:46 +01:00
commit 24925c88a8
7 changed files with 47 additions and 20 deletions

View file

@ -1481,16 +1481,16 @@ PType *ZCCCompiler::ResolveUserType(ZCC_BasicType *type, PSymbolTable *symt)
if (sym == nullptr && symt != &GlobalSymbols) sym = GlobalSymbols.FindSymbolInTable(type->UserType->Id, table);
if (sym != nullptr && sym->IsKindOf(RUNTIME_CLASS(PSymbolType)))
{
auto type = static_cast<PSymbolType *>(sym)->Type;
if (type->IsKindOf(RUNTIME_CLASS(PEnum)))
auto ptype = static_cast<PSymbolType *>(sym)->Type;
if (ptype->IsKindOf(RUNTIME_CLASS(PEnum)))
{
return TypeSInt32; // hack this to an integer until we can resolve the enum mess.
}
if (type->IsKindOf(RUNTIME_CLASS(PClass)))
if (ptype->IsKindOf(RUNTIME_CLASS(PClass)))
{
return NewPointer(type);
return NewPointer(ptype, type->isconst);
}
return type;
return ptype;
}
Error(type, "Unable to resolve %s as type.", FName(type->UserType->Id).GetChars());
return TypeError;