summaryrefslogtreecommitdiff
path: root/cgen.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-03-02 12:55:26 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-03-02 12:55:26 -0500
commite12efeebae81d524f96eea33813f57d4b90020bc (patch)
tree53160713ee25f9b21529194c25a85500ad3c4b91 /cgen.c
parent533955656684e8a85143e18ba299c2cffaa2db7d (diff)
got rid of Location in Type
Diffstat (limited to 'cgen.c')
-rw-r--r--cgen.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/cgen.c b/cgen.c
index 79c2745..a3903a8 100644
--- a/cgen.c
+++ b/cgen.c
@@ -35,14 +35,16 @@ static void cgen_defs_block(CGenerator *g, Block *b);
static void cgen_defs_decl(CGenerator *g, Declaration *d);
#define cgen_recurse_subexprs_fn_simple(fn, decl_f, block_f) \
- FnExpr *prev_fn = g->f##n; \
- g->f##n = fn; \
- arr_foreach(fn->params, Declaration, param) \
- decl_f(g, param); \
- arr_foreach(fn->ret_decls, Declaration, r) \
- decl_f(g, r); \
- block_f(g, &fn->body); \
- g->f##n = prev_fn;
+ if (!(fn->flags & FN_EXPR_FOREIGN)) { \
+ FnExpr *prev_fn = g->f##n; \
+ g->f##n = fn; \
+ arr_foreach(fn->params, Declaration, param) \
+ decl_f(g, param); \
+ arr_foreach(fn->ret_decls, Declaration, r) \
+ decl_f(g, r); \
+ block_f(g, &fn->body); \
+ g->f##n = prev_fn; \
+ }
/* calls f on every sub-expression of e, block_f on every sub-block, and decl_f on every sub-declaration. */
#define cgen_recurse_subexprs(g, e, f, block_f, decl_f) \