public static bool EnumNext(object enumObj)
{
ScriptRuntime.IdEnumeration x = (ScriptRuntime.IdEnumeration)enumObj;
if (x.iterator != null)
{
object v = ScriptableObject.GetProperty(x.iterator, "next");
if (!(v is Callable))
{
return false;
}
Callable f = (Callable)v;
Context cx = Context.GetContext();
try
{
x.currentId = f.Call(cx, x.iterator.GetParentScope(), x.iterator, emptyArgs);
return true;
}
catch (JavaScriptException e)
{
if (e.GetValue() is NativeIterator.StopIteration)
{
return false;
}
throw;
}
}
for (; ; )
{
if (x.obj == null)
{
return false;
}
if (x.index == x.ids.Length)
{
x.obj = x.obj.GetPrototype();
EnumChangeObject(x);
continue;
}
object id = x.ids[x.index++];
if (x.used != null && x.used.Has(id))
{
continue;
}
if (id is string)
{
string strId = (string)id;
if (!x.obj.Has(strId, x.obj))
{
continue;
}
// must have been deleted
x.currentId = strId;
}
else
{
int intId = System.Convert.ToInt32(((Number)id));
if (!x.obj.Has(intId, x.obj))
{
continue;
}
// must have been deleted
x.currentId = x.enumNumbers ? (object)(Sharpen.Extensions.ValueOf(intId)) : intId.ToString();
}
return true;
}
}