{
// clear this map because it points to AST nodes.
ov.getDeferredClassMap().clear();
// clean slots in the ObjectValue
final Slots ovSlots = ov.slots;
if (ovSlots != null)
{
for (int i = 0, length = ovSlots.size(); i < length; i++)
{
final Slot slot = ovSlots.get(i);
// the following block should be relatively in sync with ContextStatics.cleanSlot()
if (slot != null)
{
slot.setImplNode(null);
}
}
}
}
// for each QName definition, clean each slot in TypeValue slot and its prototype
if (cx != null && definitions != null)
{
for (int i = 0, size = definitions.size(); i < size; i++)
{
final TypeValue value = cx.userDefined((definitions.get(i)).toString());
if (value != null)
{
final Slots valueSlots = value.slots;
if (valueSlots != null)
{
for (int j = 0, length = valueSlots.size(); j < length; j++)
{
ContextStatics.cleanSlot(valueSlots.get(j));
}
}
final ObjectValue proto = value.prototype;
if (proto != null)
{
final Slots protoSlots = proto.slots;
if (protoSlots != null)
{
for (int j = 0, length = protoSlots.size(); j < length; j++)
{
ContextStatics.cleanSlot(protoSlots.get(j));
}
}
}
}
}