mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- added ProcessStruct, analogous to ProcessClass.
Now everything should be in place to resolve all constants - inside and outside classes or structs.
This commit is contained in:
parent
d139ee9f68
commit
5bb6bb31ca
2 changed files with 48 additions and 2 deletions
|
@ -82,13 +82,58 @@ void ZCCCompiler::ProcessClass(ZCC_Class *cnode, PSymbolTreeNode *tnode)
|
|||
case AST_States:
|
||||
case AST_VarDeclarator:
|
||||
case AST_FuncDeclarator:
|
||||
case AST_Default:
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0 && "Unhandled AST node type");
|
||||
break;
|
||||
}
|
||||
node = node->SiblingNext;
|
||||
}
|
||||
while (node != cnode->Body);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ZCCCompiler :: ProcessClass
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *tnode)
|
||||
{
|
||||
Structs.Push(ZCC_StructWork(static_cast<ZCC_Struct *>(cnode), tnode));
|
||||
ZCC_StructWork &cls = Structs.Last();
|
||||
|
||||
auto node = cnode->Body;
|
||||
|
||||
do
|
||||
{
|
||||
switch (node->NodeType)
|
||||
{
|
||||
case AST_ConstantDef:
|
||||
if ((tnode = AddNamedNode(static_cast<ZCC_NamedNode *>(node))))
|
||||
{
|
||||
cls.Constants.Push(static_cast<ZCC_ConstantDef *>(node)); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AST_Enum: break;
|
||||
case AST_EnumTerminator:break;
|
||||
|
||||
// todo
|
||||
case AST_VarDeclarator:
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0 && "Unhandled AST node type");
|
||||
break;
|
||||
}
|
||||
node = node->SiblingNext;
|
||||
}
|
||||
while (node != cnode->Body);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ZCCCompiler Constructor
|
||||
|
@ -114,8 +159,8 @@ ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols,
|
|||
{
|
||||
switch (node->NodeType)
|
||||
{
|
||||
case AST_Class: ProcessClass(static_cast<ZCC_Class *>(node), tnode); break;
|
||||
case AST_Struct: Structs.Push(ZCC_StructWork(static_cast<ZCC_Struct *>(node), tnode)); break;
|
||||
case AST_Class: ProcessClass(static_cast<ZCC_Class *>(node), tnode); break;
|
||||
case AST_Struct: ProcessStruct(static_cast<ZCC_Struct *>(node), tnode); break;
|
||||
case AST_ConstantDef: Constants.Push(static_cast<ZCC_ConstantDef *>(node)); break;
|
||||
default: assert(0 && "Default case is just here to make GCC happy. It should never be reached");
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
|
||||
private:
|
||||
void ProcessClass(ZCC_Class *node, PSymbolTreeNode *tnode);
|
||||
void ProcessStruct(ZCC_Struct *node, PSymbolTreeNode *tnode);
|
||||
void CreateStructTypes();
|
||||
void CreateClassTypes();
|
||||
void CompileConstants(const TArray<ZCC_ConstantDef *> &defs);
|
||||
|
|
Loading…
Reference in a new issue