don't forget to globalise variables before making them global.

This commit is contained in:
Vítor Santos Costa 2009-04-29 14:21:52 +01:00
parent bcfa642520
commit 8c3406adac
1 changed files with 10 additions and 1 deletions

View File

@ -1242,7 +1242,16 @@ p_b_setval(void)
WRITE_LOCK(ge->GRWLock);
#ifdef MULTI_ASSIGNMENT_VARIABLES
/* the evil deed is to be done now */
MaBind(&ge->global, ARG2);
{
/* but first make sure we are doing on a global object, or a constant! */
Term t = Deref(ARG2);
if (IsVarTerm(t) && VarOfTerm(t) > H && VarOfTerm(t) < ASP) {
Term tn = MkVarTerm();
Bind_Local(VarOfTerm(t), tn);
t = tn;
}
MaBind(&ge->global, t);
}
WRITE_UNLOCK(ge->GRWLock);
return TRUE;
#else