summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-08 14:32:22 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-08 14:33:21 -0400
commit70523d86da174587d0fe9658169dd33d97b52122 (patch)
treeabdcbdedf71285c57e25e39e35dec05a294d8cb4 /scope.c
parent9c4be69bbd707e96eec176cad4188dcba265eb4c (diff)
eval fn calling (eval is done!!)
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index 5d01c6f..8ecda21 100644
--- a/scope.c
+++ b/scope.c
@@ -54,3 +54,18 @@ static void block_exit(Block *b, Statement *stmts) {
}
}
}
+
+/* does NOT enter function's block body */
+static void fn_enter(FnExpr *f) {
+ arr_foreach(f->params, Declaration, decl)
+ add_ident_decls(&f->body, decl);
+ arr_foreach(f->ret_decls, Declaration, decl)
+ add_ident_decls(&f->body, decl);
+}
+
+static void fn_exit(FnExpr *f) {
+ arr_foreach(f->params, Declaration, decl)
+ remove_ident_decls(&f->body, decl);
+ arr_foreach(f->ret_decls, Declaration, decl)
+ remove_ident_decls(&f->body, decl);
+}