native: fix return `a+b` infix construction (#12161)
parent
6c728cf389
commit
ade5774313
|
@ -777,7 +777,6 @@ pub fn (mut g Gen) call_fn(node ast.CallExpr) {
|
||||||
if !n.contains('.') {
|
if !n.contains('.') {
|
||||||
n = 'main.$n'
|
n = 'main.$n'
|
||||||
}
|
}
|
||||||
eprintln('call fn ($n)')
|
|
||||||
addr := g.fn_addr[n]
|
addr := g.fn_addr[n]
|
||||||
if addr == 0 {
|
if addr == 0 {
|
||||||
// g.warning('fn addr of `$name` = 0')
|
// g.warning('fn addr of `$name` = 0')
|
||||||
|
|
|
@ -468,8 +468,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
||||||
g.mov64(.rax, e0.val.int())
|
g.mov64(.rax, e0.val.int())
|
||||||
}
|
}
|
||||||
ast.InfixExpr {
|
ast.InfixExpr {
|
||||||
// TODO
|
g.infix_expr(e0)
|
||||||
// verror('expr')
|
|
||||||
}
|
}
|
||||||
ast.CastExpr {
|
ast.CastExpr {
|
||||||
g.mov64(.rax, e0.expr.str().int())
|
g.mov64(.rax, e0.expr.str().int())
|
||||||
|
@ -482,7 +481,6 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
||||||
}
|
}
|
||||||
ast.Ident {
|
ast.Ident {
|
||||||
g.expr(e0)
|
g.expr(e0)
|
||||||
eprintln('ident $e0.name')
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
g.n_error('unknown return type $e0.type_name()')
|
g.n_error('unknown return type $e0.type_name()')
|
||||||
|
|
|
@ -10,10 +10,9 @@ fn sumcall2(a int, b int) int {
|
||||||
fn main() {
|
fn main() {
|
||||||
r := sumcall (1,2)
|
r := sumcall (1,2)
|
||||||
assert r == 3
|
assert r == 3
|
||||||
/*
|
|
||||||
// XXX not yet working
|
|
||||||
s := sumcall2 (1,2)
|
s := sumcall2 (1,2)
|
||||||
assert r == 3
|
assert s == 3
|
||||||
*/
|
|
||||||
exit(0)
|
exit(0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue