native: fix return `a+b` infix construction (#12161)

pull/12170/head
pancake 2021-10-12 18:38:17 +02:00 committed by GitHub
parent 6c728cf389
commit ade5774313
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

View File

@ -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')

View File

@ -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()')

View File

@ -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)
}