no :: in func decls

This commit is contained in:
2026-06-30 19:31:26 +02:00
parent ae5af37b85
commit 07c560b750
107 changed files with 580 additions and 520 deletions
+7
View File
@@ -2256,6 +2256,11 @@ parse_top_level :: proc(parser: ^Parser) {
}
parser.cursor = saved
}
if current(parser).kind == .Keyword_Func || current(parser).kind == .Keyword_C_Func {
c_abi := current(parser).kind == .Keyword_C_Func
parse_function(parser, name, c_abi)
return
}
type_syntax := types.INVALID
if is_type_token(current(parser).kind) {
type_syntax = parse_type(parser)
@@ -2271,6 +2276,8 @@ parse_top_level :: proc(parser: ^Parser) {
if operator.kind == .Colon_Colon &&
(current(parser).kind == .Keyword_Func || current(parser).kind == .Keyword_C_Func) {
source.add(parser.diagnostics, span_from(name.span, current(parser).span),
"function declarations do not use '::'; write 'name func(...)' or 'name c_func(...)'")
c_abi := current(parser).kind == .Keyword_C_Func
parse_function(parser, name, c_abi)
return