From 3ac08fa19f0c55b886f239dd6dcd1163a189d86b Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 9 Aug 2019 02:45:55 +0200 Subject: [PATCH] :art: Add Tuple header --- include/instr.h | 3 --- include/tuple.h | 19 +++++++++++++++++++ include/type.h | 13 ------------- src/emit/emit.c | 1 + src/lib/tuple.c | 1 + src/oo/type.c | 1 + src/parse/check.c | 1 + 7 files changed, 23 insertions(+), 16 deletions(-) create mode 100644 include/tuple.h diff --git a/include/instr.h b/include/instr.h index cd95e22e..1f97a27d 100644 --- a/include/instr.h +++ b/include/instr.h @@ -64,9 +64,6 @@ INSTR(PopArrayClass); INSTR(DotTmpl); INSTR(GTmpl); -INSTR(TupleCtor); -INSTR(TupleMember); - struct dottmpl_ { size_t len; m_str name; diff --git a/include/tuple.h b/include/tuple.h new file mode 100644 index 00000000..22759d21 --- /dev/null +++ b/include/tuple.h @@ -0,0 +1,19 @@ +#ifndef __TUPLE +#define __TUPLE +typedef struct TupleForm_* TupleForm; +struct TupleForm_ { + struct Vector_ types; + struct Vector_ offset; + Type_List list; +}; + +ANN Type tuple_type(const Env, const Vector, const loc_t); +ANN void tuple_info(const Env, Type_Decl*, const Var_Decl); +ANN TupleForm new_tupleform(MemPool p); +ANN void free_tupleform(MemPool p, const TupleForm tuple); + +#ifdef __INSTR +INSTR(TupleCtor); +INSTR(TupleMember); +#endif +#endif diff --git a/include/type.h b/include/type.h index 6e3ae9ec..4880184d 100644 --- a/include/type.h +++ b/include/type.h @@ -1,13 +1,6 @@ #ifndef __TYPE #define __TYPE -typedef struct TupleForm_* TupleForm; -struct TupleForm_ { - struct Vector_ types; - struct Vector_ offset; - Type_List list; -}; - struct TypeInfo_ { Type parent; Nspc owner; @@ -59,11 +52,5 @@ ANN static inline m_bool is_fptr(const Type t) { return isa(actual_type(t), t_fptr) > 0; } ANN m_uint get_depth(const Type type); - - -ANN Type tuple_type(const Env, const Vector, const loc_t); -ANN void tuple_info(const Env, Type_Decl*, const Var_Decl); -ANN TupleForm new_tupleform(MemPool p); -ANN void free_tupleform(MemPool p, const TupleForm tuple); #endif diff --git a/src/emit/emit.c b/src/emit/emit.c index 9737a985..7d827856 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -23,6 +23,7 @@ #include "import.h" #include "switch.h" #include "parser.h" +#include "tuple.h" #undef insert_symbol #define insert_symbol(a) insert_symbol(emit->gwion->st, (a)) diff --git a/src/lib/tuple.c b/src/lib/tuple.c index c82e7a2c..18d03bc5 100644 --- a/src/lib/tuple.c +++ b/src/lib/tuple.c @@ -18,6 +18,7 @@ #include "value.h" #include "parse.h" #include "cpy_ast.h" +#include "tuple.h" struct TupleEmit { Exp e; diff --git a/src/oo/type.c b/src/oo/type.c index f8707e7a..605c961a 100644 --- a/src/oo/type.c +++ b/src/oo/type.c @@ -9,6 +9,7 @@ #include "traverse.h" #include "parse.h" #include "gwion.h" +#include "tuple.h" ANN static void free_type(Type a, Gwion gwion) { if(GET_FLAG(a, template)) { diff --git a/src/parse/check.c b/src/parse/check.c index 9f7b5d44..48cfaf0a 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -19,6 +19,7 @@ #include "nspc.h" #include "switch.h" #include "cpy_ast.h" +#include "tuple.h" ANN static Type check_exp(const Env env, Exp exp); ANN static m_bool check_stmt_list(const Env env, Stmt_List list); -- 2.43.0