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

View File

@ -1242,7 +1242,16 @@ p_b_setval(void)
WRITE_LOCK(ge->GRWLock); WRITE_LOCK(ge->GRWLock);
#ifdef MULTI_ASSIGNMENT_VARIABLES #ifdef MULTI_ASSIGNMENT_VARIABLES
/* the evil deed is to be done now */ /* 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); WRITE_UNLOCK(ge->GRWLock);
return TRUE; return TRUE;
#else #else