harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d0faf0d052dccc5d5a1c305f8353178414a5b51e
parent c6795a36c897dc809659b67c14d6f39dd28e9386
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Wed,  1 Dec 2021 05:08:29 +0000

Fix exported @symbol globals

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/check.c | 4+---
Msrc/typedef.c | 6+++---
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -2973,11 +2973,9 @@ check_global(struct context *ctx, decl->global.type = type; if (adecl->symbol) { - decl->ident.name = strdup(adecl->symbol); decl->symbol = strdup(adecl->symbol); - } else { - mkident(ctx, &decl->ident, &adecl->ident); } + mkident(ctx, &decl->ident, &adecl->ident); if (!adecl->init) { return decl; // Forward declaration diff --git a/src/typedef.c b/src/typedef.c @@ -390,11 +390,11 @@ static void emit_decl_global(struct declaration *decl, FILE *out) { char *ident = identifier_unparse(&decl->ident); - fprintf(out, "export"); + fprintf(out, "export let "); if (decl->symbol) { - fprintf(out, " @symbol(\"%s\") ", decl->symbol); + fprintf(out, "@symbol(\"%s\") ", decl->symbol); } - fprintf(out, " let %s: ", ident); + fprintf(out, "%s: ", ident); emit_exported_type(decl->global.type, out); fprintf(out, ";\n"); }