From: Lukas Krickl Date: Tue, 12 Dec 2023 08:27:38 +0000 (+0100) Subject: Fixed symbol scoping rules X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=5b7366ebef82c630b60b1aac5f5ac6af80ed4f9f;p=ulas%2F.git Fixed symbol scoping rules --- diff --git a/src/ulas.c b/src/ulas.c index 0117150..d544753 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -287,7 +287,7 @@ int ulas_symbolset(const char *cname, int scope, struct ulas_tok tok, struct ulas_sym *existing = ulas_symbolresolve(name, scope, &resolve_rc); // inc scope when symbol is global - if (name[0] != ULAS_TOK_SCOPED_SYMBOL_BEGIN) { + if (name[0] != ULAS_TOK_SCOPED_SYMBOL_BEGIN && cname[len - 1] == ':') { ulas.scope++; } diff --git a/tests/t0.bin b/tests/t0.bin index 6ca8b43..94bb56d 100644 Binary files a/tests/t0.bin and b/tests/t0.bin differ diff --git a/tests/t0.s b/tests/t0.s index 5ee5c65..d0124db 100644 --- a/tests/t0.s +++ b/tests/t0.s @@ -105,3 +105,7 @@ j1: .adv 1 l3: .db 1 ld a, l3 + +; local label forward declaration + call @fl0 +@fl0: