diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-12 18:55:46 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-08-12 19:06:03 +0300 |
| commit | 2157fdbaca0b80e488c4f77ad5c0d04b051175cf (patch) | |
| tree | 6a6ba7be30b2eb32219cd9aa2eb30c3bddacd5b4 /src/ast.c | |
| parent | ce6ba9e8d260e43d11518688363229755a212472 (diff) | |
| download | ek-2157fdbaca0b80e488c4f77ad5c0d04b051175cf.tar.gz ek-2157fdbaca0b80e488c4f77ad5c0d04b051175cf.zip | |
make defer work better with generic code
Diffstat (limited to 'src/ast.c')
| -rw-r--r-- | src/ast.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -753,3 +753,30 @@ size_t type_offsetof(struct type *t, char *m) return offset; } + +struct ast *reverse_ast_list(struct ast *root) +{ + struct ast *new_root = NULL; + while (root) { + struct ast *next = root->n; + root->n = new_root; + new_root = root; + root = next; + } + + return new_root; +} + +struct type *reverse_type_list(struct type *root) +{ + struct type *new_root = NULL; + while (root) { + struct type *next = root->n; + root->n = new_root; + new_root = root; + root = next; + } + + return new_root; +} + |
