public virtual bool HasInstance(object instance)
{
if ((instance is ObjectInstance) == false)
return false;
object functionPrototype = this["prototype"];
if ((functionPrototype is ObjectInstance) == false)
throw new JavaScriptException(this.Engine, ErrorType.TypeError, "Function has non-object prototype in instanceof check");
var instancePrototype = ((ObjectInstance)instance).Prototype;
while (instancePrototype != null)
{
if (instancePrototype == functionPrototype)
return true;
instancePrototype = instancePrototype.Prototype;
}
return false;
}