mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 14:32:24 +00:00
Restore result variable just for issue #40 using same fix as J. Templ.
This commit is contained in:
parent
6a4748e2af
commit
03556336ce
22 changed files with 171 additions and 5 deletions
|
|
@ -69,6 +69,7 @@ export void OPC_IntLiteral (int64 n, int32 size);
|
|||
export void OPC_Len (OPT_Object obj, OPT_Struct array, int64 dim);
|
||||
static void OPC_LenList (OPT_Object par, BOOLEAN ansiDefine, BOOLEAN showParamName);
|
||||
static int16 OPC_Length (CHAR *s, LONGINT s__len);
|
||||
export BOOLEAN OPC_NeedsRetval (OPT_Object proc);
|
||||
export int32 OPC_NofPtrs (OPT_Struct typ);
|
||||
static int16 OPC_PerfectHash (CHAR *s, LONGINT s__len);
|
||||
static BOOLEAN OPC_Prefixed (OPT_ConstExt x, CHAR *y, LONGINT y__len);
|
||||
|
|
@ -1428,6 +1429,11 @@ void OPC_DefineInter (OPT_Object proc)
|
|||
OPM_WriteLn();
|
||||
}
|
||||
|
||||
BOOLEAN OPC_NeedsRetval (OPT_Object proc)
|
||||
{
|
||||
return (proc->typ != OPT_notyp && !proc->scope->leaf);
|
||||
}
|
||||
|
||||
void OPC_EnterProc (OPT_Object proc)
|
||||
{
|
||||
OPT_Object var = NIL, scope = NIL;
|
||||
|
|
@ -1448,6 +1454,12 @@ void OPC_EnterProc (OPT_Object proc)
|
|||
OPM_WriteString((CHAR*)"_s", 3);
|
||||
OPC_EndStat();
|
||||
}
|
||||
if (OPC_NeedsRetval(proc)) {
|
||||
OPC_BegStat();
|
||||
OPC_Ident(proc->typ->strobj);
|
||||
OPM_WriteString((CHAR*)" __retval", 10);
|
||||
OPC_EndStat();
|
||||
}
|
||||
var = proc->link;
|
||||
while (var != NIL) {
|
||||
if ((var->typ->comp == 2 && var->mode == 1)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue