aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-01-02 14:45:39 +0000
committergingerBill <bill@gingerbill.org>2022-01-02 14:45:39 +0000
commit3cbf9c37193a2852db9ac52b9d9699169318d277 (patch)
tree7f2fc7d9e62499cc14879c38b4881a89fdc99ced /src/parser.cpp
parent50188f03086da716a8f23926ae10be6fd87abab4 (diff)
Fix #1381
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index cbd4d61d5..5bf43cee9 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -5362,6 +5362,15 @@ isize calc_decl_count(Ast *decl) {
count += calc_decl_count(decl->BlockStmt.stmts.data[i]);
}
break;
+ case Ast_WhenStmt:
+ {
+ isize inner_count = calc_decl_count(decl->WhenStmt.body);
+ if (decl->WhenStmt.else_stmt) {
+ inner_count = gb_max(inner_count, calc_decl_count(decl->WhenStmt.else_stmt));
+ }
+ count += inner_count;
+ }
+ break;
case Ast_ValueDecl:
count = decl->ValueDecl.names.count;
break;