[Commit] nickle ChangeLog,1.69,1.70 compile.c,1.156,1.157

Keith Packard commit at keithp.com
Thu Jun 17 16:53:44 PDT 2004


Committed by: keithp

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

Modified Files:
	ChangeLog compile.c 
Log Message:
2004-06-17  Keith Packard  <keithp at keithp.com>
2.39
	* compile.c: (CompileLvalue):
	Generalize the previous fix to handle the remaining cases,
	including names.


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- ChangeLog	17 Jun 2004 20:46:09 -0000	1.69
+++ ChangeLog	17 Jun 2004 23:53:41 -0000	1.70
@@ -1,4 +1,10 @@
 2004-06-17  Keith Packard  <keithp at keithp.com>
+2.39
+	* compile.c: (CompileLvalue):
+	Generalize the previous fix to handle the remaining cases,
+	including names.
+
+2004-06-17  Keith Packard  <keithp at keithp.com>
 
 	* gram.y:
 	Update conflict comment to note new reduce/reduce

Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -d -r1.156 -r1.157
--- compile.c	17 Jun 2004 20:30:47 -0000	1.156
+++ compile.c	17 Jun 2004 23:53:41 -0000	1.157
@@ -452,6 +452,8 @@
 /*
  * Compile the left side of an assignment statement.
  * The result is a 'ref' left in the value register
+ * The type is the type of the refered value, not a reference
+ * to that type.
  */
 ObjPtr
 CompileLvalue (ObjPtr obj, ExprPtr expr, ExprPtr stat, CodePtr code,
@@ -634,14 +636,7 @@
 		expr->base.type = NewTypeRef (t, True);
 		if (assign)
 		    inst->base.opCode++;
-	    }
-	    else
-	    {
-		/*
-		 * reference to a non-reference type.  Error
-		 */
-		CompileError (obj, stat, "Object right of '&' is not of ref type");
-		expr->base.type = typePoly;
+		amper = False;
 	    }
 	}
 	else
@@ -667,15 +662,27 @@
 	    }
 	}
     }
-    else
+    /*
+     * Handle any remaining & from above
+     */
+    if (amper)
     {
-	if (amper && auto_reference)
+	if (auto_reference)
 	{
 	    BuildInst (obj, OpUnFunc, inst, stat);
 	    inst->unfunc.func = do_reference;
 	    expr->base.type = NewTypeRef (expr->base.type, True);
 	}
+	else
+	{
+	    /*
+	     * reference to a non-reference type.  Error
+	     */
+	    CompileError (obj, stat, "Object right of '&' is not of ref type");
+	    expr->base.type = typePoly;
+	}
     }
+	
     assert (expr->base.type);
     RETURN (obj);
 }




More information about the Commit mailing list