1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: make go func with array type work (#15747)

This commit is contained in:
Swastik Baranwal 2022-09-13 17:23:43 +05:30 committed by GitHub
parent f51384c402
commit a3d6a9349d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -1718,7 +1718,7 @@ fn (mut g Gen) go_expr(node ast.GoExpr) {
}
if expr.is_method {
receiver_sym := g.table.sym(expr.receiver_type)
name = receiver_sym.name + '_' + name
name = receiver_sym.cname + '_' + name
} else if mut expr.left is ast.AnonFn {
if expr.left.inherited_vars.len > 0 {
fn_var := g.fn_var_signature(expr.left.decl.return_type, expr.left.decl.params.map(it.typ),

View File

@ -0,0 +1,9 @@
const text = 'Hello world'
fn test_go_call_fn_return() {
hex_go := go text.bytes().hex()
hex := text.bytes().hex()
assert hex == '48656c6c6f20776f726c64'
assert hex_go.wait() == hex
}