diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 03:09:23 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-04-15 03:09:23 +0300 |
| commit | 1b58c86d6856339d71bfc124fc8f48fbd2b09fd0 (patch) | |
| tree | a638375b37aa294c1b2e4f6f6623345f6b5a4559 /src/lower.c | |
| parent | 2ef60c2a9520b02256c6f5051468aedbfb69683b (diff) | |
| download | ek-1b58c86d6856339d71bfc124fc8f48fbd2b09fd0.tar.gz ek-1b58c86d6856339d71bfc124fc8f48fbd2b09fd0.zip | |
initial working struct call tests pass
Diffstat (limited to 'src/lower.c')
| -rw-r--r-- | src/lower.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lower.c b/src/lower.c index dba4e5c..1ce91a4 100644 --- a/src/lower.c +++ b/src/lower.c @@ -193,14 +193,14 @@ static char *mangle_idx(struct ast *id, size_t idx) assert(id->scope); assert(id->s); - const char *name = id->s; + char *name = id->s; /* oh wait, I need to do a variable lookup on the ID, not use the ID's * scope number, duh */ - size_t number = get_scope_number(id); - - if (ast_flags(id, AST_FLAG_NOMANGLE)) + struct ast *def = file_scope_find_symbol(id->scope, name); + if (ast_flags(def, AST_FLAG_NOMANGLE)) return strdup(name); + size_t number = get_scope_number(def); return build_str("%s_s%zif%zi", name, number, idx); } @@ -410,7 +410,7 @@ static void do_store(struct lower_state *s, struct retval *from, int64_t addr = strtoll(o.s, 0, 0); /* doesn't really take into account possible padding etc, should * probably fix at some point */ - printf("%s >> %s %s %zi;\n", from->s, retval_type_str(t), t.s, addr); + printf("%s >> %s %s %zi;\n", from->s, retval_type_str(*from), t.s, addr); } static int lower_cast(struct lower_state *s, struct ast *e, |
