예제 #1
0
inline ReturnedValue thisNumberValue(ExecutionContext *ctx)
{
    if (ctx->thisObject().isNumber())
        return ctx->thisObject().asReturnedValue();
    NumberObject *n = ctx->thisObject().asNumberObject();
    if (!n)
        return ctx->engine()->throwTypeError();
    return Encode(n->value());
}
예제 #2
0
inline double thisNumber(ExecutionContext *ctx)
{
    if (ctx->thisObject().isNumber())
        return ctx->thisObject().asDouble();
    NumberObject *n = ctx->thisObject().asNumberObject();
    if (!n)
        return ctx->engine()->throwTypeError();
    return n->value();
}
예제 #3
0
inline double thisNumber(Scope &scope, CallData *callData)
{
    if (callData->thisObject.isNumber())
        return callData->thisObject.asDouble();
    NumberObject *n = callData->thisObject.as<NumberObject>();
    if (!n) {
        scope.engine->throwTypeError();
        return 0;
    }
    return n->value();
}
예제 #4
0
inline ReturnedValue thisNumberValue(Scope &scope, CallData *callData)
{
    if (callData->thisObject.isNumber())
        return callData->thisObject.asReturnedValue();
    NumberObject *n = callData->thisObject.as<NumberObject>();
    if (!n) {
        scope.engine->throwTypeError();
        return Encode::undefined();
    }
    return Encode(n->value());
}