Skip to content

Commit

Permalink
Allow using Self as the class name in the default block to refer to…
Browse files Browse the repository at this point in the history
… the current class
  • Loading branch information
RicardoLuis0 committed Oct 26, 2024
1 parent 59dab44 commit d7f16ac
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/scripting/zscript/zcc_compile_doom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,15 @@ void ZCCDoomCompiler::ProcessDefaultProperty(PClassActor *cls, ZCC_PropertyStmt
}
else if (namenode->SiblingNext->SiblingNext == namenode)
{
FName name(namenode->Id);

if(name == NAME_self)
{
name = cls->TypeName;
}

// a two-name property
propname << FName(namenode->Id).GetChars() << "." << FName(static_cast<ZCC_Identifier *>(namenode->SiblingNext)->Id).GetChars();
propname << name.GetChars() << "." << FName(static_cast<ZCC_Identifier *>(namenode->SiblingNext)->Id).GetChars();
}
else
{
Expand Down Expand Up @@ -784,6 +791,13 @@ void ZCCDoomCompiler::ProcessDefaultFlag(PClassActor *cls, ZCC_FlagStmt *flg)
else if (namenode->SiblingNext->SiblingNext == namenode)
{
// a two-name flag

if(namenode->Id == NAME_self)
{
n1 = cls->TypeName.GetChars();
}


n2 = FName(static_cast<ZCC_Identifier *>(namenode->SiblingNext)->Id).GetChars();
}
else
Expand Down

0 comments on commit d7f16ac

Please sign in to comment.