From 6075f33768b3a160fa1a06e54253f9cd565241ec Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Tue, 8 Oct 2019 14:32:22 -0400 Subject: eval fn calling (eval is done./runv) --- scope.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'scope.c') 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); +} -- cgit v1.2.3