diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-07-09 16:14:53 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-07-09 16:14:53 +0200 |
commit | 244b63b06e32a69417b6b78c2213045196c731d2 (patch) | |
tree | ea2d5317a0141baca88d70e18a2de16ebb4c038f | |
parent | 5483cfe95e156118c01c35492c2d3a29ff5a2b15 (diff) |
Throw error when attempting to declare a local variable ‘pub’
-rw-r--r-- | src/parser.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); |