harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

commit d5ded03c6fabc9cd07aa56f2cae00f120da47479
parent dac4cd7c49c8d0539e8aefda4a812dff522c86a9
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  1 Oct 2022 11:13:55 +0200

check/mkident: don't overwrite ns if present

This fixes forward declarations for declarations in other modules, e.g.

fn sched::addtask(state: *taskstate) void;

Diffstat:
Msrc/check.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/check.c b/src/check.c @@ -20,7 +20,7 @@ void mkident(struct context *ctx, struct identifier *out, const struct identifier *in) { identifier_dup(out, in); - if (ctx->ns) { + if (ctx->ns && !in->ns) { out->ns = xcalloc(1, sizeof(struct identifier)); identifier_dup(out->ns, ctx->ns); }