Example #1
0
JSValue JavaInstance::defaultValue(ExecState* exec, PreferredPrimitiveType hint) const
{
    if (hint == PreferString)
        return stringValue(exec);
    if (hint == PreferNumber)
        return numberValue(exec);
    JavaClass* aClass = static_cast<JavaClass*>(getClass());
    if (aClass->isStringClass())
        return stringValue(exec);
    if (aClass->isNumberClass())
        return numberValue(exec);
    if (aClass->isBooleanClass())
        return booleanValue();
    return valueOf(exec);
}
Example #2
0
JSValue* JavaInstance::defaultValue(ExecState* exec, JSType hint) const
{
    if (hint == StringType)
        return stringValue(exec);
    if (hint == NumberType)
        return numberValue(exec);
    if (hint == BooleanType)
        return booleanValue();
    if (hint == UnspecifiedType) {
        JavaClass *aClass = static_cast<JavaClass*>(getClass());
        if (aClass->isStringClass())
            return stringValue(exec);
        if (aClass->isNumberClass())
            return numberValue(exec);
        if (aClass->isBooleanClass())
            return booleanValue();
    }
    
    return valueOf(exec);
}