mirror of
https://github.com/irmen/prog8.git
synced 2026-10-22 05:02:58 +00:00
fix code generation for "return <void function call>"
This commit is contained in:
1 parent
7f3b2e8aa6
commit
ba76fbfe85
4 files changed
+81
-1
No files matched your search
@@ -1895,7 +1895,14 @@ class IRCodeGen(
|
||||
}
|
||||
|
||||
val value = ret.children.singleOrNull()
|
||||
if(value==null) {
|
||||
if(ret.numReturnValues()==0) {
|
||||
// a void subroutine may return the result of a void function call (e.g. "return voidfunc(args)"):
|
||||
// translate the call for its side effects, then return void
|
||||
val callValue = value as? PtExpression
|
||||
if(callValue!=null)
|
||||
result += expressionEval.translateExpression(callValue).chunks
|
||||
addInstr(result, IRInstructions.returnVoid(), null)
|
||||
} else if(value==null) {
|
||||
addInstr(result, IRInstructions.returnVoid(), null)
|
||||
} else {
|
||||
value as PtExpression
|
||||
|
||||
Reference in new issue
Block a user