Function call in an expression
never does pop temp 0. After the call returns the return value is on the top of the stack so that it can be stored or used in further computation.
// var Thing obj;
// var String brand;
// let brand = obj.Varname()
push local 0 // 'this' for Varname
...
@Thing.Varname
0;JMP
($RET$123) // return value is at top of stack
pop local 1 // store return value in brand
Function call in a do statement
always does pop temp 0 after the call returns to get rid of the return value that is being ignored. Without the pop temp 0, the return value would remain on the stack and the SP would be one greater than it should be.
// var Thing obj;
// do obj.Varname()
push local 0 // 'this' for Varname
...
@Thing.Varname
0;JMP
($RET$456) // return value is at top of stack
pop temp 0 // throw away return value