aboutsummaryrefslogtreecommitdiff
path: root/source/20-codegen-compiler/CodegenDecl.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/20-codegen-compiler/CodegenDecl.hpp')
-rw-r--r--source/20-codegen-compiler/CodegenDecl.hpp27
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;