X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/dbc4a22d3c8c4189459f0361cb9da06415ec2dc9..17860defa84c6d8bc0e8bc088a7e09361f17db07:/src/repr.h diff --git a/src/repr.h b/src/repr.h index f196427..709528d 100644 --- a/src/repr.h +++ b/src/repr.h @@ -37,6 +37,15 @@ struct AssignStmt; struct ReturnStmt; struct Stmt; +struct Context +{ + std::optional name; + std::shared_ptr parent; + std::vector variables; + std::vector functions; + std::vector structs; +}; + enum class TypeModifierType { Pointer, Array @@ -55,6 +64,7 @@ struct Type std::vector namespacePrefixes; std::string name; std::vector modifiers; + std::vector genericInstantiation; }; struct Variable @@ -65,15 +75,20 @@ struct Variable struct Body { - std::vector variables; + std::shared_ptr ctx; std::vector statements; }; struct Function { - Type returnType; std::string name; + Type returnType; std::vector parameters; + bool defined; + + std::vector genericTypeNames; + std::vector> genericInstantiations; + Body body; }; @@ -88,6 +103,8 @@ struct StructMember struct Struct { std::string name; + std::vector genericTypeNames; + std::vector> genericInstantiations; std::vector> members; std::vector> methods; }; @@ -95,17 +112,13 @@ struct Struct struct Namespace { std::string name; - std::vector variables; - std::vector structs; - std::vector functions; + std::shared_ptr ctx; std::vector namespaces; }; struct Program { - std::vector variables; - std::vector structs; - std::vector functions; + std::shared_ptr ctx; std::vector namespaces; }; @@ -119,6 +132,7 @@ struct FuncExpr std::vector namespacePrefixes; std::string functionName; std::vector arguments; + std::vector genericInstantiation; }; struct MethodExpr @@ -126,6 +140,7 @@ struct MethodExpr std::shared_ptr expr; std::string methodName; std::vector arguments; + std::vector genericInstantiation; }; enum class LitType @@ -150,6 +165,7 @@ struct ParenExpr struct DotExpr { + bool isPointer; std::shared_ptr expr; std::string identifier; };