diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-27 13:01:36 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-27 13:01:36 -0500 |
commit | 3467f27c4c0d44f5bb2a09d93a96c71a4c0eeccc (patch) | |
tree | b83c7e7829069603d9c2e282eed70e50f9e006c0 | |
parent | 730469c7a96a26ecba362db39c67e97bd07bf157 (diff) |
fixed #include scoping problems
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | test.toc | 3 | ||||
-rw-r--r-- | types.h | 2 |
4 files changed, 6 insertions, 2 deletions
@@ -18,7 +18,6 @@ /* TODO: -#include nested packages constants in structs #if @@ -75,6 +75,8 @@ static void block_exit(Block *b, Statement *stmts) { if (stmt->kind == STMT_DECL) { Declaration *decl = &stmt->decl; remove_ident_decls(b, decl); + } else if (stmt->kind == STMT_INCLUDE) { + block_exit(b, stmt->inc.stmts); } } } @@ -2,7 +2,10 @@ arr ::= pkg "std/arr"; io ::= pkg "std/io"; main ::= fn() { #include "incstuff.toc"; + { + #include "incstuff.toc"; + } s : [1]char; s[0] = (arr.arr_len(x) as char) + '0'; io.puts(s[:]); @@ -754,7 +754,7 @@ typedef struct Expression { } del; struct { struct Expression *name_expr; - } pkg; /* only can exist before typing */ + } pkg; /* can only exist before typing */ IfExpr if_; WhileExpr while_; ForExpr *for_; |