Add function body to ZCC_FuncDeclarator

This commit is contained in:
Randy Heit 2013-07-10 23:26:56 -05:00
parent 572823046c
commit 6088acd4c0
3 changed files with 4 additions and 1 deletions

View file

@ -548,7 +548,8 @@ static void PrintFuncDeclarator(FString &out, ZCC_TreeNode *node)
out << "\n(func-declarator "; out << "\n(func-declarator ";
PrintNodes(out, dnode->Type); PrintNodes(out, dnode->Type);
out.AppendFormat("%x %s ", dnode->Flags, FName(dnode->Name).GetChars()); out.AppendFormat("%x %s ", dnode->Flags, FName(dnode->Name).GetChars());
PrintNodes(out, dnode->Params, ')'); PrintNodes(out, dnode->Params, ' ');
PrintNodes(out, dnode->Body, ')');
out << '\n'; out << '\n';
} }

View file

@ -533,6 +533,7 @@ declarator(X) ::= decl_flags(A) type_list_or_void(B) variables_or_function(C).
decl->Params = C.FuncParams; decl->Params = C.FuncParams;
decl->Name = C.FuncName; decl->Name = C.FuncName;
decl->Flags = A | C.FuncFlags; decl->Flags = A | C.FuncFlags;
decl->Body = C.FuncBody;
X = decl; X = decl;
} }
else if (B != NULL && B->SiblingNext == B) else if (B != NULL && B->SiblingNext == B)

View file

@ -493,6 +493,7 @@ struct ZCC_FuncDeclarator : ZCC_Declarator
{ {
ZCC_FuncParamDecl *Params; ZCC_FuncParamDecl *Params;
ENamedName Name; ENamedName Name;
ZCC_Statement *Body;
}; };
FString ZCC_PrintAST(ZCC_TreeNode *root); FString ZCC_PrintAST(ZCC_TreeNode *root);