aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2026-02-15 17:20:41 +0100
committerGitHub <noreply@github.com>2026-02-15 17:20:41 +0100
commit60fe21e086548293aefa559ff8bf10898b8f0114 (patch)
treeeae402fb27e8e0d2f22d6ddc2534cbfbb3e78899 /src/parser.cpp
parent730e6ce0d4b483cd01a51c6345c37972ef5fd4b3 (diff)
parenta84179de1fdf9674bd25a9cebb672bf190d4bade (diff)
Merge pull request #6286 from krnowak/krnowak/duplicate-partial-switch
Do not allow duplicated #partial directives on switch statements
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 159eb65f8..fe42739b8 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -5427,9 +5427,15 @@ gb_internal Ast *parse_stmt(AstFile *f) {
s = parse_stmt(f);
switch (s->kind) {
case Ast_SwitchStmt:
+ if (s->SwitchStmt.partial) {
+ syntax_error(token, "#partial already applied to a switch statement");
+ }
s->SwitchStmt.partial = true;
break;
case Ast_TypeSwitchStmt:
+ if (s->TypeSwitchStmt.partial) {
+ syntax_error(token, "#partial already applied to a switch statement");
+ }
s->TypeSwitchStmt.partial = true;
break;
case Ast_EmptyStmt: