private static bool EqString(CharSequence x, object y)
{
for (; ; )
{
if (y == null || y == Undefined.instance)
{
return false;
}
else
{
if (y is CharSequence)
{
CharSequence c = (CharSequence)y;
return x.Length == c.Length && x.ToString().Equals(c.ToString());
}
else
{
if (y is Number)
{
return ToNumber(x.ToString()) == System.Convert.ToDouble(((Number)y));
}
else
{
if (y is bool)
{
return ToNumber(x.ToString()) == (((bool)y) ? 1.0 : 0.0);
}
else
{
if (y is Scriptable)
{
if (y is ScriptableObject)
{
object test = ((ScriptableObject)y).EquivalentValues(x.ToString());
if (test != ScriptableConstants.NOT_FOUND)
{
return ((bool)test);
}
}
y = ToPrimitive(y);
continue;
}
else
{
WarnAboutNonJSObject(y);
return false;
}
}
}
}
}
}
}