From 244b63b06e32a69417b6b78c2213045196c731d2 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 9 Jul 2024 16:14:53 +0200 Subject: Throw error when attempting to declare a local variable ‘pub’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parser.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/parser.c b/src/parser.c index eff98df..3fdde5e 100644 --- a/src/parser.c +++ b/src/parser.c @@ -403,6 +403,8 @@ parsestmt(ast_t *ast, aux_t *aux, lexemes_t toks) || toks.kinds[toksidx + 1] == LEXCOLON) { i = parsedecl(ast, aux, toks, false); + } else if (strview_eq(SV("pub"), sv)) { + err("parser: Attempted to use ‘pub’ outside of a global scope"); } else /* assignment or funcall */ { idx_t lhs, rhs; i = astalloc(ast); -- cgit v1.2.3