o = value->asReturnedValue();
if (o) {
- if (NumberObject *n = o->asNumberObject())
+ if (NumberObject *n = o->as<NumberObject>())
value = Encode(n->value());
else if (StringObject *so = o->as<StringObject>())
value = so->d()->value;
ScopedValue v(scope);
for (uint i = 0; i < arrayLen; ++i) {
v = o->getIndexed(i);
- if (v->asNumberObject() || v->as<StringObject>() || v->isNumber())
+ if (v->as<NumberObject>() || v->as<StringObject>() || v->isNumber())
v = RuntimeHelpers::toString(scope.engine, v);
if (v->isString()) {
String *s = v->stringValue();
}
ScopedValue s(scope, ctx->argument(2));
- if (NumberObject *n = s->asNumberObject())
+ if (NumberObject *n = s->as<NumberObject>())
s = Encode(n->value());
else if (StringObject *so = s->as<StringObject>())
s = so->d()->value;
Object *asObject() { return d()->vtable->isObject ? reinterpret_cast<Object *>(this) : 0; }
FunctionObject *asFunctionObject() { return d()->vtable->isFunctionObject ? reinterpret_cast<FunctionObject *>(this) : 0; }
BooleanObject *asBooleanObject() { return d()->vtable->type == Type_BooleanObject ? reinterpret_cast<BooleanObject *>(this) : 0; }
- NumberObject *asNumberObject() { return d()->vtable->type == Type_NumberObject ? reinterpret_cast<NumberObject *>(this) : 0; }
ArgumentsObject *asArgumentsObject() { return d()->vtable->type == Type_ArgumentsObject ? reinterpret_cast<ArgumentsObject *>(this) : 0; }
bool isListType() const { return d()->vtable->type == Type_QmlSequence; }
{
if (ctx->thisObject().isNumber())
return ctx->thisObject().asReturnedValue();
- NumberObject *n = ctx->thisObject().asNumberObject();
+ NumberObject *n = ctx->thisObject().as<NumberObject>();
if (!n)
return ctx->engine()->throwTypeError();
return Encode(n->value());
{
if (ctx->thisObject().isNumber())
return ctx->thisObject().asDouble();
- NumberObject *n = ctx->thisObject().asNumberObject();
+ NumberObject *n = ctx->thisObject().as<NumberObject>();
if (!n)
return ctx->engine()->throwTypeError();
return n->value();
return isObject() ? managed()->asFunctionObject() : 0;
}
-inline NumberObject *Value::asNumberObject() const
-{
- return isObject() ? managed()->asNumberObject() : 0;
-}
-
template<>
inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v)
{
inline Managed *asManaged() const;
inline Object *asObject() const;
inline FunctionObject *asFunctionObject() const;
- inline NumberObject *asNumberObject() const;
template <typename T>
const T *as() const {