no :: in func decls
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -279,7 +279,7 @@ emit_functions :: proc(b: ^strings.Builder, result: ^cimport.Result, record_name
|
||||
wrote = true
|
||||
continue
|
||||
}
|
||||
fmt.sbprintf(b, "%s :: ", function.name)
|
||||
fmt.sbprintf(b, "%s ", function.name)
|
||||
render_c_func(b, result, function.params, function.param_names, function.result, function.variadic, record_names)
|
||||
strings.write_byte(b, '\n')
|
||||
wrote = true
|
||||
|
||||
Reference in New Issue
Block a user