diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-01 17:39:47 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-04-01 17:39:47 -0400 |
commit | 157ffb0e7c17c61d05462e5ffdce19620485b0b1 (patch) | |
tree | 1c8d5f1583a2b247ddb6a12ef23d2f3bed253e92 /types.h | |
parent | 8b93c704d059609f9ba8e3d946a9dc722e72318e (diff) |
block cleanup
Diffstat (limited to 'types.h')
-rw-r--r-- | types.h | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -488,15 +488,21 @@ typedef struct Field { enum { - BLOCK_IS_FN = 0x01, - BLOCK_IS_NMS = 0x02, - BLOCK_FINDING_TYPES = 0x04, - BLOCK_FOUND_TYPES = 0x08, - BLOCK_IS_LOOP = 0x10 /* can we break/continue in this block? */ + BLOCK_FINDING_TYPES = 0x01, + BLOCK_FOUND_TYPES = 0x02, }; +typedef enum { + BLOCK_OTHER, + BLOCK_FN, + BLOCK_NMS, + BLOCK_FOR, + BLOCK_WHILE +} BlockKind; + typedef U8 BlockFlags; typedef struct Block { BlockFlags flags; + BlockKind kind; struct { IdentID break_lbl, cont_lbl; /* initially 0, set to non-zero values if needed (++g->lbl_counter); set by sdecls_cgen. */ } c; @@ -506,6 +512,7 @@ typedef struct Block { struct Expression *ret_expr; /* the return expression of this block, e.g. {foo(); 3} => 3 NULL for no expression. */ struct Block *parent; struct Statement **deferred; /* deferred stuff from this block; used by both eval and cgen */ + struct Statement **used; /* use statements (for types.c) */ } Block; enum { @@ -1038,16 +1045,6 @@ typedef struct Evaluator { ForeignFnManager ffmgr; } Evaluator; -/* -Keeps track of use stmts. -We need to keep track of the block so that -it can be removed when we exit the block. -*/ -typedef struct { - Statement *stmt; - Block *scope; -} UsedExpr; - typedef struct Typer { Allocator *allocr; Evaluator *evalr; @@ -1061,7 +1058,6 @@ typedef struct Typer { ParsedFile *parsed_file; Namespace *nms; StrHashTable included_files; /* maps to IncludedFile */ - UsedExpr *used; /* things which are currently being `use`d. dynamic array NOT on the allocator. */ File *file; } Typer; |