summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-25 09:57:28 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-25 09:57:52 -0400
commit7352f2c357619e23ed348bdadd48f38f9acd4d86 (patch)
tree39ac2440fb5d58866bc1ac9e57ff58424c235640 /scope.c
parente278a73bbe573b45f67794301746b08b8fa5c4b2 (diff)
compile time arrays and slices!
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index 5afee76..e715cc3 100644
--- a/scope.c
+++ b/scope.c
@@ -26,6 +26,8 @@ static void remove_ident_decls(Block *b, Declaration *d) {
IdentDecl *last_decl = arr_last(*decls);
if (last_decl && last_decl->scope == b) {
if ((last_decl->flags & IDECL_FLAG_HAS_VAL)
+ /* don't free const arrays (there's only one per decl) */
+ && !(last_decl->decl->flags & DECL_FLAG_CONST)
&& last_decl->decl->type.kind == TYPE_ARR) {
/* free array on stack */
free(last_decl->val.arr);