added class pointer casts. Due to grammar problems the type has to be put into parentheses to get the class token out of the global parsing namespace:
class<Actor> myclass = (class<Actor>)(GetClass());
This commit is contained in:
parent
022228d8a9
commit
3bcd85eb8a
8 changed files with 167 additions and 0 deletions
|
|
@ -2766,6 +2766,24 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast)
|
|||
break;
|
||||
}
|
||||
|
||||
case AST_ClassCast:
|
||||
{
|
||||
auto cc = static_cast<ZCC_ClassCast *>(ast);
|
||||
if (cc->Parameters == nullptr || cc->Parameters->SiblingNext != cc->Parameters)
|
||||
{
|
||||
Error(cc, "Class type cast requires exactly one parameter");
|
||||
return new FxNop(*ast); // return something so that the compiler can continue.
|
||||
}
|
||||
auto cls = PClass::FindClass(cc->ClassName);
|
||||
if (cls == nullptr)
|
||||
{
|
||||
Error(cc, "Unknown class %s", FName(cc->ClassName).GetChars());
|
||||
return new FxNop(*ast); // return something so that the compiler can continue.
|
||||
}
|
||||
return new FxClassPtrCast(cls, ConvertNode(cc->Parameters));
|
||||
}
|
||||
|
||||
|
||||
case AST_ExprMemberAccess:
|
||||
{
|
||||
auto memaccess = static_cast<ZCC_ExprMemberAccess *>(ast);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue