File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -314,11 +314,32 @@ fn (mut g Gen) gen_assign_stmt(node_ ast.AssignStmt) {
314
314
}
315
315
func := right_sym.info as ast.FnType
316
316
ret_styp := g.typ (func.func.return_type)
317
- g.write ('$ret_styp (*${g.get_ternary_name(ident.name)} ) (' )
317
+
318
+ mut call_conv := ''
319
+ mut msvc_call_conv := ''
320
+ for attr in func.func.attrs {
321
+ match attr.name {
322
+ 'callconv' {
323
+ if g.is_cc_msvc {
324
+ msvc_call_conv = '__$attr.arg '
325
+ } else {
326
+ call_conv = '$attr.arg '
327
+ }
328
+ }
329
+ else {}
330
+ }
331
+ }
332
+ call_conv_attribute_suffix := if call_conv.len != 0 {
333
+ '__attribute__(($call_conv ))'
334
+ } else {
335
+ ''
336
+ }
337
+
338
+ g.write ('$ret_styp ($msvc_call_conv *${g.get_ternary_name(ident.name)} ) (' )
318
339
def_pos := g.definitions.len
319
340
g.fn_decl_params (func.func.params, voidptr (0 ), false )
320
341
g.definitions.go_back (g.definitions.len - def_pos)
321
- g.write (')' )
342
+ g.write (')$call_conv_attribute_suffix ' )
322
343
} else {
323
344
if is_decl {
324
345
if is_inside_ternary {
You can’t perform that action at this time.
0 commit comments