File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1922,6 +1922,13 @@ fn (mut g Gen) go_expr(node ast.GoExpr) {
1922
1922
g.gowrappers.write_string (call_args_str)
1923
1923
} else {
1924
1924
for i in 0 .. expr.args.len {
1925
+ expected_nr_muls := expr.expected_arg_types[i].nr_muls ()
1926
+ arg_nr_muls := expr.args[i].typ.nr_muls ()
1927
+ if arg_nr_muls > expected_nr_muls {
1928
+ g.gowrappers.write_string ('*' .repeat (arg_nr_muls - expected_nr_muls))
1929
+ } else if arg_nr_muls < expected_nr_muls {
1930
+ g.gowrappers.write_string ('&' .repeat (expected_nr_muls - arg_nr_muls))
1931
+ }
1925
1932
g.gowrappers.write_string ('arg->arg${i + 1} ' )
1926
1933
if i != expr.args.len - 1 {
1927
1934
g.gowrappers.write_string (', ' )
Original file line number Diff line number Diff line change
1
+ struct Foo {
2
+ bar string
3
+ }
4
+
5
+ fn test_go_anon_fn_call_with_ref_arg () {
6
+ foo := & Foo{
7
+ bar: 'hello'
8
+ }
9
+ g := go fn (foo Foo) string {
10
+ return foo.bar
11
+ }(foo)
12
+ ret := g.wait ()
13
+ println (ret)
14
+ assert ret == 'hello'
15
+ }
You can’t perform that action at this time.
0 commit comments