[Commit] nickle ChangeLog,1.121,1.122 compile.c,1.160,1.161

Keith Packard commit at keithp.com
Fri Jan 14 08:58:56 PST 2005


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv10083

Modified Files:
	ChangeLog compile.c 
Log Message:
2005-01-14  Keith Packard  <keithp at keithp.com>

	* compile.c: (CompileCall):
	Functions returning reference type need auto-dereference on
	return value


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- ChangeLog	14 Jan 2005 05:51:23 -0000	1.121
+++ ChangeLog	14 Jan 2005 16:58:53 -0000	1.122
@@ -1,3 +1,9 @@
+2005-01-14  Keith Packard  <keithp at keithp.com>
+
+	* compile.c: (CompileCall):
+	Functions returning reference type need auto-dereference on
+	return value
+
 2005-01-13  Keith Packard  <keithp at keithp.com>
 version 2.46
 

Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- compile.c	15 Nov 2004 19:32:43 -0000	1.160
+++ compile.c	14 Jan 2005 16:58:53 -0000	1.161
@@ -1107,6 +1107,7 @@
     InstPtr inst;
     int	    argc;
     Bool    varactual;
+    TypePtr t;
 
     obj = _CompileExpr (obj, expr->tree.left, True, stat, code);
     obj = CompileArgs (obj, &argc, &varactual, expr->tree.right, True, stat, code);
@@ -1117,6 +1118,9 @@
 	RETURN (obj);
     }
     expr->base.type = TypeCombineReturn (expr->tree.left->base.type);
+    t = CompileRefType (obj, expr, expr->base.type);
+    if (t)
+	tail = TailNever;
     if ((tail == TailAlways &&
 	 !TypePoly (expr->base.type) &&
 	 TypeIsSupertype (code->base.type, expr->base.type)) ||
@@ -1130,7 +1134,14 @@
     {
 	BuildInst (obj, OpCall, inst, stat);
 	inst->ints.value = varactual ? -argc : argc;
-	BuildInst (obj, OpNoop, inst, stat);
+	if (t)
+	{
+	    BuildInst (obj, OpUnFunc, inst, stat);
+	    inst->unfunc.func = Dereference;
+	    expr->base.type = t;
+	}
+	else
+	    BuildInst (obj, OpNoop, inst, stat);
     }
     RETURN (obj);
 }




More information about the Commit mailing list