@@ -50,8 +50,8 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
5050 }
5151 } else if mut expr.left is ast.AnonFn {
5252 if expr.left.inherited_vars.len > 0 {
53- fn_var := g.fn_var_signature (expr.left.decl.return_type, expr.left.decl.params.map (it .typ),
54- tmp_fn, 0 )
53+ fn_var := g.fn_var_signature (ast.void_type, expr.left.decl.return_type, expr.left.decl.params.map (it .typ),
54+ tmp_fn)
5555 g.write ('\t ${fn_var } = ' )
5656 g.gen_anon_fn (mut expr.left)
5757 g.writeln (';' )
@@ -65,8 +65,8 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
6565 if expr.is_fn_var {
6666 fn_sym := g.table.sym (expr.fn_var_type)
6767 func := (fn_sym.info as ast.FnType ).func
68- fn_var := g.fn_var_signature (func.return_type, func.params.map (it .typ), tmp_fn ,
69- 0 )
68+ fn_var := g.fn_var_signature (ast.void_type, func.return_type, func.params.map (it .typ),
69+ tmp_fn )
7070 g.write ('\t ${fn_var } = ' )
7171 g.expr (expr.left)
7272 g.writeln (';' )
@@ -185,11 +185,12 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
185185 if node.call_expr.is_fn_var {
186186 fn_sym := g.table.sym (node.call_expr.fn_var_type)
187187 info := fn_sym.info as ast.FnType
188- fn_var = g.fn_var_signature (info.func.return_type, info.func.params.map (it .typ),
189- 'fn' , 0 )
188+ fn_var = g.fn_var_signature (ast.void_type, info.func.return_type, info.func.params.map (it .typ),
189+ 'fn' )
190190 } else if node.call_expr.left is ast.AnonFn {
191191 f := node.call_expr.left.decl
192- fn_var = g.fn_var_signature (f.return_type, f.params.map (it .typ), 'fn' , 0 )
192+ fn_var = g.fn_var_signature (ast.void_type, f.return_type, f.params.map (it .typ),
193+ 'fn' )
193194 } else {
194195 if node.call_expr.is_method {
195196 rec_sym := g.table.sym (g.unwrap_generic (node.call_expr.receiver_type))
@@ -200,7 +201,8 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
200201 mut arg_types := f.params.map (it .typ)
201202 arg_types = arg_types.map (muttable.convert_generic_type (it , f.generic_names,
202203 node.call_expr.concrete_types) or { it })
203- fn_var = g.fn_var_signature (return_type, arg_types, 'fn' , 0 )
204+ fn_var = g.fn_var_signature (ast.void_type, return_type, arg_types,
205+ 'fn' )
204206 }
205207 } else {
206208 if f := g.table.find_fn (node.call_expr.name) {
@@ -223,7 +225,8 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
223225 }
224226 }
225227 }
226- fn_var = g.fn_var_signature (return_type, arg_types, 'fn' , 0 )
228+ fn_var = g.fn_var_signature (ast.void_type, return_type, arg_types,
229+ 'fn' )
227230 }
228231 }
229232 }
@@ -238,8 +241,8 @@ fn (mut g Gen) spawn_and_go_expr(node ast.SpawnExpr, mode SpawnGoMode) {
238241 for i, arg in expr.args {
239242 arg_sym := g.table.sym (arg.typ)
240243 if arg_sym.info is ast.FnType {
241- sig := g.fn_var_signature (arg_sym.info.func.return_type, arg_sym.info.func.params.map (it .typ),
242- 'arg${i + 1 }' , arg.typ. nr_muls () )
244+ sig := g.fn_var_signature (arg.typ, arg_sym.info.func.return_type, arg_sym.info.func.params.map (it .typ),
245+ 'arg${i + 1 }' )
243246 g.type_definitions.writeln ('\t ' + sig + ';' )
244247 } else {
245248 styp := g.styp (arg.typ)
0 commit comments