diff options
author | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
commit | bd07ae3f4e1bcdedc3e373460671ca9713a03de5 (patch) | |
tree | 15c897891474a97983f247196923f8e4f2184083 /source/20-codegen-compiler/CodegenDecl.hpp | |
parent | 8a0f2cd0b398ee0b7740e44a0e5fb2f75d090ccb (diff) |
Changeset: 60 Add struct/class scanning to codegen
Diffstat (limited to 'source/20-codegen-compiler/CodegenDecl.hpp')
-rw-r--r-- | source/20-codegen-compiler/CodegenDecl.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
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 <string> #include <vector> +// 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<const DeclStruct*> baseClasses; + std::vector<DeclMemberVariable> memberVariables; + std::vector<DeclMemberVariable> generatedVariables; + std::vector<DeclMemberFunction> memberFunctions; + std::vector<DeclMemberFunction> 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<DeclEnumElement> 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<DeclFunctionArgument> arguments; std::string body; |