From bd07ae3f4e1bcdedc3e373460671ca9713a03de5 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 2 Jun 2022 21:34:16 -0700 Subject: Changeset: 60 Add struct/class scanning to codegen --- source/20-codegen-compiler/CodegenDecl.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source/20-codegen-compiler/CodegenDecl.hpp') diff --git a/source/20-codegen-compiler/CodegenDecl.hpp b/source/20-codegen-compiler/CodegenDecl.hpp index 32d5445..0728c08 100644 --- a/source/20-codegen-compiler/CodegenDecl.hpp +++ b/source/20-codegen-compiler/CodegenDecl.hpp @@ -3,16 +3,41 @@ #include #include +// TODO replace std::string name with std::string_view into the token storage? + struct DeclNamespace { DeclNamespace* container = nullptr; std::string name; std::string_view fullname; // View into storage map key }; +struct DeclStruct; +struct DeclMemberVariable { + DeclStruct* containerStruct = nullptr; + std::string name; + std::string type; + std::string getterName; + std::string setterName; +}; +struct DeclMemberFunction { + DeclStruct* containerStruct = nullptr; + // TODO +}; + // Structs or classes struct DeclStruct { DeclNamespace* container = nullptr; + std::vector baseClasses; + std::vector memberVariables; + std::vector generatedVariables; + std::vector memberFunctions; + std::vector generatedFunctions; std::string name; + std::string_view fullname; + + // Scanned generation options + bool generating : 1 = false; + bool generatingInheritanceHiearchy : 1 = false; }; enum EnumUnderlyingType { @@ -49,6 +74,7 @@ struct DeclEnumElement { struct DeclEnum { DeclNamespace* container = nullptr; std::string name; + std::string_view fullname; std::vector elements; EnumUnderlyingType underlyingType; // Start with invalid value, calculate on demand @@ -68,6 +94,7 @@ struct DeclFunction { // Things like extern, static, etc. that gets written before the function return type std::string prefix; std::string name; + std::string_view fullname; std::string returnType; std::vector arguments; std::string body; -- cgit v1.2.3-70-g09d2