- changed grammar for a class's default block to look and act like DECORATE, so that it can hook into the same property dispatcher.

This had been defined as a regular compound statement but in the context this will be used in, that makes very little sense, because all it can do is set some constant values.
The most important thing here is that it doesn't provide an unnecessary learning curve to its users and doing it this way will not only ensure that but also avoid redundant documentation.
To allow initialization of other user-defined properties it will require some extensions but that's a job for later and can just as easily be done in the current framework, rather than throwing everything out and start from zero.
This commit is contained in:
Christoph Oelckers 2016-10-10 16:53:24 +02:00
commit 2b9af0176c
3 changed files with 104 additions and 3 deletions

View file

@ -814,6 +814,26 @@ static void PrintFuncDeclarator(FLispString &out, ZCC_TreeNode *node)
out.Close();
}
static void PrintFlagStmt(FLispString &out, ZCC_TreeNode *node)
{
auto dnode = (ZCC_FlagStmt *)node;
out.Break();
out.Open("flag-stmt");
PrintNodes(out, dnode->name, false);
out.AddInt(dnode->set);
out.Close();
}
static void PrintPropertyStmt(FLispString &out, ZCC_TreeNode *node)
{
auto dnode = (ZCC_PropertyStmt *)node;
out.Break();
out.Open("property-stmt");
PrintNodes(out, dnode->Prop, false);
PrintNodes(out, dnode->Values, false);
out.Close();
}
void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *) =
{
PrintIdentifier,
@ -863,7 +883,9 @@ void (* const TreeNodePrinter[NUM_AST_NODE_TYPES])(FLispString &, ZCC_TreeNode *
PrintDeclarator,
PrintVarDeclarator,
PrintFuncDeclarator,
PrintDefault
PrintDefault,
PrintFlagStmt,
PrintPropertyStmt
};
FString ZCC_PrintAST(ZCC_TreeNode *root)