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('.') {
|
||||
n = 'main.$n'
|
||||
}
|
||||
eprintln('call fn ($n)')
|
||||
addr := g.fn_addr[n]
|
||||
if addr == 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())
|
||||
}
|
||||
ast.InfixExpr {
|
||||
// TODO
|
||||
// verror('expr')
|
||||
g.infix_expr(e0)
|
||||
}
|
||||
ast.CastExpr {
|
||||
g.mov64(.rax, e0.expr.str().int())
|
||||
|
@ -482,7 +481,6 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
}
|
||||
ast.Ident {
|
||||
g.expr(e0)
|
||||
eprintln('ident $e0.name')
|
||||
}
|
||||
else {
|
||||
g.n_error('unknown return type $e0.type_name()')
|
||||
|
|
|
@ -10,10 +10,9 @@ fn sumcall2(a int, b int) int {
|
|||
fn main() {
|
||||
r := sumcall (1,2)
|
||||
assert r == 3
|
||||
/*
|
||||
// XXX not yet working
|
||||
|
||||
s := sumcall2 (1,2)
|
||||
assert r == 3
|
||||
*/
|
||||
assert s == 3
|
||||
|
||||
exit(0)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue