aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-08-12 18:55:46 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-08-12 19:06:03 +0300
commit2157fdbaca0b80e488c4f77ad5c0d04b051175cf (patch)
tree6a6ba7be30b2eb32219cd9aa2eb30c3bddacd5b4 /include
parentce6ba9e8d260e43d11518688363229755a212472 (diff)
downloadek-2157fdbaca0b80e488c4f77ad5c0d04b051175cf.tar.gz
ek-2157fdbaca0b80e488c4f77ad5c0d04b051175cf.zip
make defer work better with generic code
Diffstat (limited to 'include')
-rw-r--r--include/ek/ast.h9
-rw-r--r--include/ek/scope.h9
2 files changed, 13 insertions, 5 deletions
diff --git a/include/ek/ast.h b/include/ek/ast.h
index c1276b5..642b561 100644
--- a/include/ek/ast.h
+++ b/include/ek/ast.h
@@ -427,6 +427,7 @@ static inline bool is_primitive(struct type *t)
#define goto_label(x) return_s(x, AST_GOTO)
#define goto_defers(x) return_a0(x, AST_GOTO)
+#define goto_label_ref(x) return_a1(x, AST_GOTO)
#define gen_goto(label, defers, loc) \
gen_str1(AST_GOTO, label, defers, loc)
@@ -576,8 +577,9 @@ static inline bool is_primitive(struct type *t)
#define struct_cont_params(x) return_a0(x, AST_STRUCT_CONT_DEF)
#define struct_cont_behav(x) return_t1(x, AST_STRUCT_CONT_DEF)
#define struct_cont_body(x) return_a2(x, AST_STRUCT_CONT_DEF)
-#define gen_struct_cont(id, params, behav, body, loc) \
- gen_ast(AST_STRUCT_CONT_DEF, params, body, NULL, NULL, behav, id, 0, loc)
+#define gen_struct_cont(id, params, behav, body, loc) \
+ gen_ast(AST_STRUCT_CONT_DEF, params, body, NULL, NULL, behav, id, 0, \
+ loc)
#define val_id(x) return_s(x, AST_VAL)
#define val_val(x) return_a0(x, AST_VAL)
@@ -714,6 +716,9 @@ int equiv_node_lists(struct ast *c1, struct ast *c2);
int equiv_types(struct type *t1, struct type *t2);
int equiv_type_lists(struct type *t1, struct type *t2);
+struct ast *reverse_ast_list(struct ast *root);
+struct type *reverse_type_list(struct type *root);
+
#define foreach_node(iter, nodes) \
for (struct ast *iter = nodes; iter; iter = iter->n)
diff --git a/include/ek/scope.h b/include/ek/scope.h
index a119451..3091388 100644
--- a/include/ek/scope.h
+++ b/include/ek/scope.h
@@ -208,7 +208,8 @@ int scope_add_macro(struct scope *scope, struct ast *macro);
*/
int scope_add_trait(struct scope *scope, struct ast *trait);
-int scope_add_expd_struct(struct scope *scope, struct ast *def, struct type *types, struct ast *expanded);
+int scope_add_expd_struct(struct scope *scope, struct ast *def,
+ struct type *types, struct ast *expanded);
/**
* Find a variable with ID in \p scope.
@@ -283,7 +284,8 @@ struct ast *scope_find_alias(struct scope *scope, char *id);
*/
struct ast *scope_find_trait(struct scope *scope, char *id);
-struct ast *scope_find_expd_struct(struct scope *scope, struct ast *def, struct type *types);
+struct ast *scope_find_expd_struct(struct scope *scope, struct ast *def,
+ struct type *types);
/**
* Find a variable with ID visible to \p scope.
@@ -345,7 +347,8 @@ struct ast *file_scope_find_alias(struct scope *scope, char *id);
*/
struct ast *file_scope_find_trait(struct scope *scope, char *id);
-struct ast *file_scope_find_expd_struct(struct scope *scope, struct ast *def, struct type *types);
+struct ast *file_scope_find_expd_struct(struct scope *scope, struct ast *def,
+ struct type *types);
#define foreach_visible(iter, init) \
for (struct visible *iter = init; iter; iter = iter->next)