From cf2a253f2f60c9f0c61682527d80143e72b355d4 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 25 Sep 2013 12:24:36 +0200 Subject: Move Value::fromBool, ... to a new Primitive class This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann --- .../dialogs-private/qquickfontlistmodel.cpp | 2 +- src/imports/localstorage/plugin.cpp | 6 +- src/qml/compiler/qv4isel_masm.cpp | 18 +-- src/qml/compiler/qv4isel_masm_p.h | 8 +- src/qml/compiler/qv4isel_moth.cpp | 2 +- src/qml/compiler/qv4isel_util_p.h | 18 +-- src/qml/jsruntime/qv4argumentsobject.cpp | 6 +- src/qml/jsruntime/qv4arrayobject.cpp | 56 ++++----- src/qml/jsruntime/qv4booleanobject.cpp | 4 +- src/qml/jsruntime/qv4context.cpp | 16 +-- src/qml/jsruntime/qv4dateobject.cpp | 4 +- src/qml/jsruntime/qv4dateobject_p.h | 2 +- src/qml/jsruntime/qv4engine.cpp | 8 +- src/qml/jsruntime/qv4errorobject.cpp | 20 ++-- src/qml/jsruntime/qv4exception.cpp | 2 +- src/qml/jsruntime/qv4functionobject.cpp | 12 +- src/qml/jsruntime/qv4functionobject_p.h | 2 +- src/qml/jsruntime/qv4globalobject.cpp | 2 +- src/qml/jsruntime/qv4include.cpp | 18 +-- src/qml/jsruntime/qv4jsonobject.cpp | 14 +-- src/qml/jsruntime/qv4lookup.cpp | 26 ++-- src/qml/jsruntime/qv4math_p.h | 24 ++-- src/qml/jsruntime/qv4mathobject.cpp | 16 +-- src/qml/jsruntime/qv4mm.cpp | 4 +- src/qml/jsruntime/qv4numberobject.cpp | 18 +-- src/qml/jsruntime/qv4object.cpp | 24 ++-- src/qml/jsruntime/qv4object_p.h | 6 +- src/qml/jsruntime/qv4objectiterator.cpp | 2 +- src/qml/jsruntime/qv4objectproto.cpp | 14 +-- src/qml/jsruntime/qv4property_p.h | 2 +- src/qml/jsruntime/qv4qobjectwrapper.cpp | 6 +- src/qml/jsruntime/qv4qobjectwrapper_p.h | 2 +- src/qml/jsruntime/qv4regexp.cpp | 4 +- src/qml/jsruntime/qv4regexpobject.cpp | 24 ++-- src/qml/jsruntime/qv4runtime.cpp | 28 ++--- src/qml/jsruntime/qv4runtime_p.h | 56 ++++----- src/qml/jsruntime/qv4scopedvalue_p.h | 25 ++-- src/qml/jsruntime/qv4script.cpp | 8 +- src/qml/jsruntime/qv4sequenceobject.cpp | 12 +- src/qml/jsruntime/qv4serialize.cpp | 4 +- src/qml/jsruntime/qv4sparsearray.cpp | 2 +- src/qml/jsruntime/qv4string.cpp | 6 +- src/qml/jsruntime/qv4stringobject.cpp | 26 ++-- src/qml/jsruntime/qv4value_def_p.h | 19 ++- src/qml/jsruntime/qv4value_p.h | 30 ++--- src/qml/jsruntime/qv4vme_moth.cpp | 14 +-- src/qml/qml/qqmlboundsignal.cpp | 6 +- src/qml/qml/qqmlcomponent.cpp | 12 +- src/qml/qml/qqmlcontextwrapper.cpp | 4 +- src/qml/qml/qqmljavascriptexpression.cpp | 4 +- src/qml/qml/qqmllistwrapper.cpp | 4 +- src/qml/qml/qqmllocale.cpp | 2 +- src/qml/qml/qqmlobjectcreator.cpp | 6 +- src/qml/qml/qqmltypewrapper.cpp | 4 +- src/qml/qml/qqmlvaluetypewrapper.cpp | 2 +- src/qml/qml/qqmlvme.cpp | 6 +- src/qml/qml/qqmlvmemetaobject.cpp | 6 +- src/qml/qml/qqmlxmlhttprequest.cpp | 30 ++--- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 10 +- src/qml/qml/v8/qv4domerrors.cpp | 34 +++--- src/qml/qml/v8/qv4domerrors_p.h | 2 +- src/qml/qml/v8/qv4sqlerrors.cpp | 16 +-- src/qml/qml/v8/qv8engine_p.h | 2 +- src/qml/types/qqmldelegatemodel.cpp | 6 +- src/qml/types/qqmllistmodel.cpp | 2 +- src/qml/types/qquickworkerscript.cpp | 6 +- src/quick/items/context2d/qquickcanvasitem.cpp | 2 +- src/quick/items/context2d/qquickcontext2d.cpp | 4 +- src/quick/items/qquickitem.cpp | 24 ++-- src/quick/items/qquickloader.cpp | 2 +- .../auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 132 ++++++++++----------- tools/v4/main.cpp | 4 +- 72 files changed, 482 insertions(+), 472 deletions(-) diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp index 9d3b90f4d9..327f214145 100644 --- a/src/imports/dialogs-private/qquickfontlistmodel.cpp +++ b/src/imports/dialogs-private/qquickfontlistmodel.cpp @@ -241,7 +241,7 @@ QQmlV4Handle QQuickFontListModel::pointSizes() a->arrayReserve(size); a->arrayDataLen = size; for (int i = 0; i < size; ++i) - a->arrayData[i].value = Value::fromInt32(pss.at(i)); + a->arrayData[i].value = Primitive::fromInt32(pss.at(i)); a->setArrayLengthUnchecked(size); return QQmlV4Handle(ScopedValue(scope, a.asReturnedValue())); diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 4ca0222cf4..fdce3fe99e 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -67,7 +67,7 @@ using namespace QV4; #define V4THROW_SQL(error, desc) { \ QV4::Scoped v(scope, Value::fromString(ctx, desc)); \ QV4::Scoped ex(scope, ctx->engine->newErrorObject(v.asValue())); \ - ex->put(QV4::ScopedString(scope, ctx->engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, Value::fromInt32(error))); \ + ex->put(QV4::ScopedString(scope, ctx->engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \ ctx->throwError(ex); \ } @@ -263,7 +263,7 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) QSqlQuery query(db); bool err = false; - ScopedValue result(scope, Value::undefinedValue()); + ScopedValue result(scope, Primitive::undefinedValue()); if (query.prepare(sql)) { if (ctx->callData->argc > 1) { @@ -307,7 +307,7 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) // XXX optimize ScopedString s(scope); ScopedValue v(scope); - resultObject->put((s = ctx->engine->newIdentifier("rowsAffected")), (v = Value::fromInt32(query.numRowsAffected()))); + resultObject->put((s = ctx->engine->newIdentifier("rowsAffected")), (v = Primitive::fromInt32(query.numRowsAffected()))); resultObject->put((s = ctx->engine->newIdentifier("insertId")), (v = engine->toString(query.lastInsertId().toString()))); resultObject->put((s = ctx->engine->newIdentifier("rows")), (v = Value::fromObject(rows))); } else { diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp index c6e5385a3f..33c2279c2d 100644 --- a/src/qml/compiler/qv4isel_masm.cpp +++ b/src/qml/compiler/qv4isel_masm.cpp @@ -781,7 +781,7 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result) { - _as->storeValue(Value::fromBoolean(false), result); + _as->storeValue(Primitive::fromBoolean(false), result); } void InstructionSelection::callBuiltinThrow(V4IR::Expr *arg) @@ -794,7 +794,7 @@ typedef void *(*MiddleOfFunctionEntryPoint(ExecutionContext *, void *localsPtr)) static void *tryWrapper(ExecutionContext *context, void *localsPtr, MiddleOfFunctionEntryPoint tryBody, MiddleOfFunctionEntryPoint catchBody, QV4::StringRef exceptionVarName, ValueRef exceptionVar) { - exceptionVar = Value::undefinedValue(); + exceptionVar = Primitive::undefinedValue(); void *addressToContinueAt = 0; SafeValue *jsStackTop = context->engine->jsStackTop; try { @@ -1191,13 +1191,13 @@ void InstructionSelection::swapValues(V4IR::Temp *sourceTemp, V4IR::Temp *target QV4::Value tag; switch (registerTemp->type) { case V4IR::BoolType: - tag = QV4::Value::fromBoolean(false); + tag = QV4::Primitive::fromBoolean(false); break; case V4IR::SInt32Type: - tag = QV4::Value::fromInt32(0); + tag = QV4::Primitive::fromInt32(0); break; default: - tag = QV4::Value::undefinedValue(); + tag = QV4::Primitive::undefinedValue(); Q_UNREACHABLE(); } _as->store32(Assembler::TrustedImm32(tag.tag), addr); @@ -1858,13 +1858,13 @@ void InstructionSelection::visitRet(V4IR::Ret *s) QV4::Value upper; switch (t->type) { case V4IR::SInt32Type: - upper = QV4::Value::fromInt32(0); + upper = QV4::Primitive::fromInt32(0); break; case V4IR::BoolType: - upper = QV4::Value::fromBoolean(false); + upper = QV4::Primitive::fromBoolean(false); break; default: - upper = QV4::Value::undefinedValue(); + upper = QV4::Primitive::undefinedValue(); Q_UNREACHABLE(); } _as->or64(Assembler::TrustedImm64(((int64_t) upper.tag) << 32), @@ -1929,7 +1929,7 @@ int InstructionSelection::prepareCallData(V4IR::ExprList* args, V4IR::Expr *this _as->store32(Assembler::TrustedImm32(argc), p); p = _as->stackLayout().callDataAddress(qOffsetOf(CallData, thisObject)); if (!thisObject) - _as->storeValue(QV4::Value::undefinedValue(), p); + _as->storeValue(QV4::Primitive::undefinedValue(), p); else _as->copyValue(p, thisObject); diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h index a218853a72..291ed106cd 100644 --- a/src/qml/compiler/qv4isel_masm_p.h +++ b/src/qml/compiler/qv4isel_masm_p.h @@ -551,7 +551,7 @@ public: Q_UNUSED(argumentNumber); if (!temp) { - QV4::Value undefined = QV4::Value::undefinedValue(); + QV4::Value undefined = QV4::Primitive::undefinedValue(); move(TrustedImm64(undefined.val), dest); } else { Pointer addr = loadTempAddress(dest, temp); @@ -572,7 +572,7 @@ public: Q_UNUSED(argumentNumber); if (!expr) { - QV4::Value undefined = QV4::Value::undefinedValue(); + QV4::Value undefined = QV4::Primitive::undefinedValue(); move(TrustedImm64(undefined.val), dest); } else if (expr->asTemp()){ loadArgumentInRegister(expr->asTemp(), dest, argumentNumber); @@ -1124,7 +1124,7 @@ public: { store32(reg, addr); addr.offset += 4; - store32(TrustedImm32(QV4::Value::fromBoolean(0).tag), addr); + store32(TrustedImm32(QV4::Primitive::fromBoolean(0).tag), addr); } void storeBool(RegisterID src, RegisterID dest) @@ -1161,7 +1161,7 @@ public: { store32(reg, addr); addr.offset += 4; - store32(TrustedImm32(QV4::Value::fromInt32(0).tag), addr); + store32(TrustedImm32(QV4::Primitive::fromInt32(0).tag), addr); } void storeInt32(RegisterID reg, V4IR::Temp *target) diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 90d261620a..35fca99df4 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -840,7 +840,7 @@ void InstructionSelection::callBuiltinDeleteName(const QString &name, V4IR::Temp void InstructionSelection::callBuiltinDeleteValue(V4IR::Temp *result) { Instruction::LoadValue load; - load.value = Param::createValue(QV4::Value::fromBoolean(false)); + load.value = Param::createValue(QV4::Primitive::fromBoolean(false)); load.result = getResultParam(result); addInstruction(load); } diff --git a/src/qml/compiler/qv4isel_util_p.h b/src/qml/compiler/qv4isel_util_p.h index 610988ce0c..12a606e70c 100644 --- a/src/qml/compiler/qv4isel_util_p.h +++ b/src/qml/compiler/qv4isel_util_p.h @@ -69,30 +69,30 @@ inline QV4::Value convertToValue(V4IR::Const *c) case V4IR::MissingType: return QV4::Value::emptyValue(); case V4IR::NullType: - return QV4::Value::nullValue(); + return QV4::Primitive::nullValue(); case V4IR::UndefinedType: - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); case V4IR::BoolType: - return QV4::Value::fromBoolean(c->value != 0); + return QV4::Primitive::fromBoolean(c->value != 0); case V4IR::SInt32Type: - return QV4::Value::fromInt32(int(c->value)); + return QV4::Primitive::fromInt32(int(c->value)); case V4IR::UInt32Type: - return QV4::Value::fromUInt32(unsigned(c->value)); + return QV4::Primitive::fromUInt32(unsigned(c->value)); case V4IR::DoubleType: - return QV4::Value::fromDouble(c->value); + return QV4::Primitive::fromDouble(c->value); case V4IR::NumberType: { int ival = (int)c->value; if (canConvertToSignedInteger(c->value)) { - return QV4::Value::fromInt32(ival); + return QV4::Primitive::fromInt32(ival); } else { - return QV4::Value::fromDouble(c->value); + return QV4::Primitive::fromDouble(c->value); } } default: Q_UNREACHABLE(); } // unreachable, but the function must return something - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); } } // namespace QQmlJS diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index 34ccd0af49..61922c9d53 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -92,7 +92,7 @@ ArgumentsObject::ArgumentsObject(CallContext *context) } Q_ASSERT(LengthPropertyIndex == internalClass->find(context->engine->id_length)); Property *lp = memberData + ArrayObject::LengthPropertyIndex; - lp->value = Value::fromInt32(context->realArgumentCount); + lp->value = Primitive::fromInt32(context->realArgumentCount); } void ArgumentsObject::destroy(Managed *that) @@ -172,8 +172,8 @@ ReturnedValue ArgumentsSetterFunction::call(Managed *setter, CallData *callData) setter->engine()->current->throwTypeError(); assert(s->index < o->context->callData->argc); - o->context->callData->args[s->index] = callData->argc ? callData->args[0] : Value::undefinedValue(); - return Value::undefinedValue().asReturnedValue(); + o->context->callData->args[s->index] = callData->argc ? callData->args[0] : Primitive::undefinedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void ArgumentsObject::markObjects(Managed *that) diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 2c5670ef92..0aa7e93804 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -93,7 +93,7 @@ ArrayPrototype::ArrayPrototype(InternalClass *ic) void ArrayPrototype::init(ExecutionEngine *engine, const Value &ctor) { - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); ctor.objectValue()->defineDefaultProperty(QStringLiteral("isArray"), method_isArray, 1); defineDefaultProperty(QStringLiteral("constructor"), ctor); @@ -223,7 +223,7 @@ ReturnedValue ArrayPrototype::method_join(SimpleCallContext *ctx) for (quint32 k = 1; k < r2; ++k) { R += r4; - name = Value::fromDouble(k).toString(ctx); + name = Primitive::fromDouble(k).toString(ctx); r12 = self->get(name); if (!r12->isNullOrUndefined()) @@ -242,7 +242,7 @@ ReturnedValue ArrayPrototype::method_pop(SimpleCallContext *ctx) if (!len) { if (!instance->isArrayObject()) - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromInt32(0))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0))); return Encode::undefined(); } @@ -252,7 +252,7 @@ ReturnedValue ArrayPrototype::method_pop(SimpleCallContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len - 1); else - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(len - 1))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1))); return result.asReturnedValue(); } @@ -267,15 +267,15 @@ ReturnedValue ArrayPrototype::method_push(SimpleCallContext *ctx) double l = len; ScopedString s(scope); for (int i = 0; i < ctx->callData->argc; ++i) { - s = Value::fromDouble(l + i).toString(ctx); + s = Primitive::fromDouble(l + i).toString(ctx); instance->put(s, ctx->callData->args[i]); } double newLen = l + ctx->callData->argc; if (!instance->isArrayObject()) - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(newLen))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen))); else ctx->throwRangeError(Value::fromString(ctx, QStringLiteral("Array.prototype.push: Overflow"))); - return Value::fromDouble(newLen).asReturnedValue(); + return Primitive::fromDouble(newLen).asReturnedValue(); } if (!instance->protoHasArray() && instance->arrayDataLen <= len) { @@ -301,7 +301,7 @@ ReturnedValue ArrayPrototype::method_push(SimpleCallContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len); else - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(len))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len))); return Encode(len); } @@ -340,8 +340,8 @@ ReturnedValue ArrayPrototype::method_shift(SimpleCallContext *ctx) if (!len) { if (!instance->isArrayObject()) - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromInt32(0))); - return Value::undefinedValue().asReturnedValue(); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromInt32(0))); + return Primitive::undefinedValue().asReturnedValue(); } Property *front = 0; @@ -349,7 +349,7 @@ ReturnedValue ArrayPrototype::method_shift(SimpleCallContext *ctx) if (pidx < UINT_MAX && (!instance->arrayAttributes || !instance->arrayAttributes[0].isGeneric())) front = instance->arrayData + pidx; - Value result = front ? Value::fromReturnedValue(instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data)) : Value::undefinedValue(); + Value result = front ? Value::fromReturnedValue(instance->getValue(front, instance->arrayAttributes ? instance->arrayAttributes[pidx] : Attr_Data)) : Primitive::undefinedValue(); if (!instance->protoHasArray() && instance->arrayDataLen <= len) { if (!instance->sparseArray) { @@ -382,7 +382,7 @@ ReturnedValue ArrayPrototype::method_shift(SimpleCallContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(len - 1); else - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(len - 1))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - 1))); return result.asReturnedValue(); } @@ -492,7 +492,7 @@ ReturnedValue ArrayPrototype::method_splice(SimpleCallContext *ctx) instance->putIndexed(start + i, ctx->callData->args[i + 2]); ctx->strictMode = true; - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(len - deleteCount + itemCount))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(len - deleteCount + itemCount))); return newArray.asReturnedValue(); } @@ -542,7 +542,7 @@ ReturnedValue ArrayPrototype::method_unshift(SimpleCallContext *ctx) if (instance->isArrayObject()) instance->setArrayLengthUnchecked(newLen); else - instance->put(ctx->engine->id_length, ScopedValue(scope, Value::fromDouble(newLen))); + instance->put(ctx->engine->id_length, ScopedValue(scope, Primitive::fromDouble(newLen))); return Encode(newLen); } @@ -554,7 +554,7 @@ ReturnedValue ArrayPrototype::method_indexOf(SimpleCallContext *ctx) ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx)); uint len = getLength(ctx, instance.getPointer()); if (!len) - return Value::fromInt32(-1).asReturnedValue(); + return Primitive::fromInt32(-1).asReturnedValue(); ScopedValue searchValue(scope); uint fromIndex = 0; @@ -562,7 +562,7 @@ ReturnedValue ArrayPrototype::method_indexOf(SimpleCallContext *ctx) if (ctx->callData->argc >= 1) searchValue = ctx->callData->args[0]; else - searchValue = Value::undefinedValue(); + searchValue = Primitive::undefinedValue(); if (ctx->callData->argc >= 2) { double f = ctx->callData->args[1].toInteger(); @@ -594,7 +594,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx) ScopedObject instance(scope, ctx->callData->thisObject.toObject(ctx)); uint len = getLength(ctx, instance.getPointer()); if (!len) - return Value::fromInt32(-1).asReturnedValue(); + return Primitive::fromInt32(-1).asReturnedValue(); ScopedValue searchValue(scope); uint fromIndex = len; @@ -602,7 +602,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx) if (ctx->callData->argc >= 1) searchValue = ctx->argument(0); else - searchValue = Value::undefinedValue(); + searchValue = Primitive::undefinedValue(); if (ctx->callData->argc >= 2) { double f = ctx->callData->args[1].toInteger(); @@ -624,7 +624,7 @@ ReturnedValue ArrayPrototype::method_lastIndexOf(SimpleCallContext *ctx) if (exists && __qmljs_strict_equal(v, searchValue)) return Encode(k); } - return Value::fromInt32(-1).asReturnedValue(); + return Primitive::fromInt32(-1).asReturnedValue(); } ReturnedValue ArrayPrototype::method_every(SimpleCallContext *ctx) @@ -652,7 +652,7 @@ ReturnedValue ArrayPrototype::method_every(SimpleCallContext *ctx) continue; callData->args[0] = v; - callData->args[1] = Value::fromDouble(k); + callData->args[1] = Primitive::fromDouble(k); r = callback->call(callData); ok = r->toBoolean(); } @@ -682,7 +682,7 @@ ReturnedValue ArrayPrototype::method_some(SimpleCallContext *ctx) continue; callData->args[0] = v; - callData->args[1] = Value::fromDouble(k); + callData->args[1] = Primitive::fromDouble(k); Value r = Value::fromReturnedValue(callback->call(callData)); if (r.toBoolean()) return Encode(true); @@ -713,7 +713,7 @@ ReturnedValue ArrayPrototype::method_forEach(SimpleCallContext *ctx) continue; callData->args[0] = v; - callData->args[1] = Value::fromDouble(k); + callData->args[1] = Primitive::fromDouble(k); callback->call(callData); } return Encode::undefined(); @@ -747,7 +747,7 @@ ReturnedValue ArrayPrototype::method_map(SimpleCallContext *ctx) continue; callData->args[0] = v; - callData->args[1] = Value::fromDouble(k); + callData->args[1] = Primitive::fromDouble(k); mapped = callback->call(callData); a->arraySet(k, mapped); } @@ -783,7 +783,7 @@ ReturnedValue ArrayPrototype::method_filter(SimpleCallContext *ctx) continue; callData->args[0] = v; - callData->args[1] = Value::fromDouble(k); + callData->args[1] = Primitive::fromDouble(k); selected = callback->call(callData); if (selected->toBoolean()) { a->arraySet(to, v); @@ -823,7 +823,7 @@ ReturnedValue ArrayPrototype::method_reduce(SimpleCallContext *ctx) } ScopedCallData callData(scope, 4); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); callData->args[0] = acc; callData->args[3] = instance; @@ -833,7 +833,7 @@ ReturnedValue ArrayPrototype::method_reduce(SimpleCallContext *ctx) if (kPresent) { callData->args[0] = acc; callData->args[1] = v; - callData->args[2] = Value::fromDouble(k); + callData->args[2] = Primitive::fromDouble(k); acc = callback->call(callData); } ++k; @@ -876,7 +876,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(SimpleCallContext *ctx) } ScopedCallData callData(scope, 4); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); callData->args[3] = instance; while (k > 0) { @@ -885,7 +885,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(SimpleCallContext *ctx) if (kPresent) { callData->args[0] = acc; callData->args[1] = v; - callData->args[2] = Value::fromDouble(k - 1); + callData->args[2] = Primitive::fromDouble(k - 1); acc = callback->call(callData); } --k; diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 7e0831232c..0a1e5449b7 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -55,7 +55,7 @@ ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData) { Scope scope(m->engine()); bool n = callData->argc ? callData->args[0].toBoolean() : false; - ScopedValue b(scope, QV4::Value::fromBoolean(n)); + ScopedValue b(scope, QV4::Primitive::fromBoolean(n)); return Encode(m->engine()->newBooleanObject(b)); } @@ -67,7 +67,7 @@ ReturnedValue BooleanCtor::call(Managed *, CallData *callData) void BooleanPrototype::init(ExecutionEngine *engine, const Value &ctor) { - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); defineDefaultProperty(QStringLiteral("constructor"), ctor); defineDefaultProperty(engine->id_toString, method_toString); diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index d47a68423c..e7ac8967a4 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -83,13 +83,13 @@ CallContext *ExecutionContext::newCallContext(void *stackSpace, Value *locals, F c->locals = locals; if (function->varCount) - std::fill(c->locals, c->locals + function->varCount, Value::undefinedValue()); + std::fill(c->locals, c->locals + function->varCount, Primitive::undefinedValue()); if (callData->argc < function->formalParameterCount) { #ifndef QT_NO_DEBUG Q_ASSERT(function->formalParameterCount <= QV4::Global::ReservedArgumentCount); #endif - std::fill(c->callData->args + callData->argc, c->callData->args + function->formalParameterCount, Value::undefinedValue()); + std::fill(c->callData->args + callData->argc, c->callData->args + function->formalParameterCount, Primitive::undefinedValue()); c->callData->argc = function->formalParameterCount; } @@ -124,12 +124,12 @@ CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData c->locals = (Value *)(c + 1); if (function->varCount) - std::fill(c->locals, c->locals + function->varCount, Value::undefinedValue()); + std::fill(c->locals, c->locals + function->varCount, Primitive::undefinedValue()); c->callData = reinterpret_cast(c->locals + function->varCount); ::memcpy(c->callData, callData, sizeof(CallData) + (callData->argc - 1) * sizeof(Value)); if (callData->argc < function->formalParameterCount) - std::fill(c->callData->args + c->callData->argc, c->callData->args + function->formalParameterCount, Value::undefinedValue()); + std::fill(c->callData->args + c->callData->argc, c->callData->args + function->formalParameterCount, Primitive::undefinedValue()); c->callData->argc = qMax((uint)callData->argc, function->formalParameterCount); return c; @@ -183,7 +183,7 @@ void ExecutionContext::createMutableBinding(const StringRef name, bool deletable if (activation->__hasProperty__(name)) return; - Property desc = Property::fromValue(Value::undefinedValue()); + Property desc = Property::fromValue(Primitive::undefinedValue()); PropertyAttributes attrs(Attr_Data); attrs.setConfigurable(deletable); activation->__defineOwnProperty__(this, name, desc, attrs); @@ -252,7 +252,7 @@ void CallContext::initQmlContext(ExecutionContext *parentContext, Object *qml, F this->callData = reinterpret_cast(this + 1); this->callData->tag = QV4::Value::Integer_Type; this->callData->argc = 0; - this->callData->thisObject = Value::undefinedValue(); + this->callData->thisObject = Primitive::undefinedValue(); strictMode = true; marked = false; @@ -270,7 +270,7 @@ void CallContext::initQmlContext(ExecutionContext *parentContext, Object *qml, F locals = (Value *)(this + 1); if (function->varCount) - std::fill(locals, locals + function->varCount, Value::undefinedValue()); + std::fill(locals, locals + function->varCount, Primitive::undefinedValue()); } @@ -522,7 +522,7 @@ ReturnedValue ExecutionContext::getPropertyNoThrow(const StringRef name) return v.asReturnedValue(); } } - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } ReturnedValue ExecutionContext::getPropertyAndBase(const StringRef name, Object **base) diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 05d4b6ee7f..2ecd80c58d 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -692,7 +692,7 @@ ReturnedValue DateCtor::construct(Managed *m, CallData *callData) t = TimeClip(UTC(t)); } - return Encode(m->engine()->newDateObject(Value::fromDouble(t))); + return Encode(m->engine()->newDateObject(Primitive::fromDouble(t))); } ReturnedValue DateCtor::call(Managed *m, CallData *) @@ -704,7 +704,7 @@ ReturnedValue DateCtor::call(Managed *m, CallData *) void DatePrototype::init(ExecutionEngine *engine, const Value &ctor) { ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(7)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(7)); LocalTZA = getLocalTZA(); ctor.objectValue()->defineDefaultProperty(QStringLiteral("parse"), method_parse, 1); diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index 758a2ce197..b560a26b7f 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -63,7 +63,7 @@ struct DateObject: Object { QDateTime toQDateTime() const; protected: - DateObject(InternalClass *ic): Object(ic), value(Value::fromDouble(qSNaN())) { + DateObject(InternalClass *ic): Object(ic), value(Primitive::fromDouble(qSNaN())) { vtbl = &static_vtbl; type = Type_DateObject; } diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 1721e59abb..2f297c34f5 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -82,7 +82,7 @@ static QBasicAtomicInt engineSerial = Q_BASIC_ATOMIC_INITIALIZER(1); static ReturnedValue throwTypeError(SimpleCallContext *ctx) { ctx->throwTypeError(); - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) @@ -280,9 +280,9 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) globalObject->defineDefaultProperty(QStringLiteral("Math"), Value::fromObject(new (memoryManager) MathObject(this))); globalObject->defineDefaultProperty(QStringLiteral("JSON"), Value::fromObject(new (memoryManager) JsonObject(this))); - globalObject->defineReadonlyProperty(QStringLiteral("undefined"), Value::undefinedValue()); - globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Value::fromDouble(std::numeric_limits::quiet_NaN())); - globalObject->defineReadonlyProperty(QStringLiteral("Infinity"), Value::fromDouble(Q_INFINITY)); + globalObject->defineReadonlyProperty(QStringLiteral("undefined"), Primitive::undefinedValue()); + globalObject->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(std::numeric_limits::quiet_NaN())); + globalObject->defineReadonlyProperty(QStringLiteral("Infinity"), Primitive::fromDouble(Q_INFINITY)); evalFunction = new (memoryManager) EvalFunction(rootContext); globalObject->defineDefaultProperty(QStringLiteral("eval"), Value::fromObject(evalFunction)); diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index c4870e13bb..d8400cd6d5 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -105,7 +105,7 @@ ErrorObject::ErrorObject(InternalClass *ic, const Value &message, ErrorType t) stackTrace = ic->engine->stackTrace(); if (!stackTrace.isEmpty()) { defineDefaultProperty(QStringLiteral("fileName"), Value::fromString(ic->engine, stackTrace.at(0).source)); - defineDefaultProperty(QStringLiteral("lineNumber"), Value::fromInt32(stackTrace.at(0).line)); + defineDefaultProperty(QStringLiteral("lineNumber"), Primitive::fromInt32(stackTrace.at(0).line)); } } @@ -132,7 +132,7 @@ ErrorObject::ErrorObject(InternalClass *ic, const QString &message, const QStrin if (!stackTrace.isEmpty()) { defineDefaultProperty(QStringLiteral("fileName"), Value::fromString(ic->engine, stackTrace.at(0).source)); - defineDefaultProperty(QStringLiteral("lineNumber"), Value::fromInt32(stackTrace.at(0).line)); + defineDefaultProperty(QStringLiteral("lineNumber"), Primitive::fromInt32(stackTrace.at(0).line)); } defineDefaultProperty(QStringLiteral("message"), Value::fromString(ic->engine->newString(message))); @@ -253,7 +253,7 @@ ErrorCtor::ErrorCtor(ExecutionContext *scope, const QString &name) ReturnedValue ErrorCtor::construct(Managed *m, CallData *callData) { - return Encode(m->engine()->newErrorObject(callData->argc ? callData->args[0] : Value::undefinedValue())); + return Encode(m->engine()->newErrorObject(callData->argc ? callData->args[0] : Primitive::undefinedValue())); } ReturnedValue ErrorCtor::call(Managed *that, CallData *callData) @@ -269,7 +269,7 @@ EvalErrorCtor::EvalErrorCtor(ExecutionContext *scope) ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) EvalErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())) + return Value::fromObject(new (m->engine()->memoryManager) EvalErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())) .asReturnedValue(); } @@ -281,7 +281,7 @@ RangeErrorCtor::RangeErrorCtor(ExecutionContext *scope) ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) RangeErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())).asReturnedValue(); + return Value::fromObject(new (m->engine()->memoryManager) RangeErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())).asReturnedValue(); } ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope) @@ -292,7 +292,7 @@ ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope) ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) ReferenceErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())).asReturnedValue(); + return Value::fromObject(new (m->engine()->memoryManager) ReferenceErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())).asReturnedValue(); } SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope) @@ -303,7 +303,7 @@ SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope) ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) SyntaxErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())).asReturnedValue(); + return Value::fromObject(new (m->engine()->memoryManager) SyntaxErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())).asReturnedValue(); } TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope) @@ -314,7 +314,7 @@ TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope) ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) TypeErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())).asReturnedValue(); + return Value::fromObject(new (m->engine()->memoryManager) TypeErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())).asReturnedValue(); } URIErrorCtor::URIErrorCtor(ExecutionContext *scope) @@ -325,13 +325,13 @@ URIErrorCtor::URIErrorCtor(ExecutionContext *scope) ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData) { - return Value::fromObject(new (m->engine()->memoryManager) URIErrorObject(m->engine(), callData->argc ? callData->args[0] : Value::undefinedValue())).asReturnedValue(); + return Value::fromObject(new (m->engine()->memoryManager) URIErrorObject(m->engine(), callData->argc ? callData->args[0] : Primitive::undefinedValue())).asReturnedValue(); } void ErrorPrototype::init(ExecutionEngine *engine, const Value &ctor, Object *obj) { ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(obj)); - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); obj->defineDefaultProperty(QStringLiteral("constructor"), ctor); obj->defineDefaultProperty(engine->id_toString, method_toString, 0); obj->defineDefaultProperty(QStringLiteral("message"), Value::fromString(engine, QString())); diff --git a/src/qml/jsruntime/qv4exception.cpp b/src/qml/jsruntime/qv4exception.cpp index 35a4f726e2..2c42e6f773 100644 --- a/src/qml/jsruntime/qv4exception.cpp +++ b/src/qml/jsruntime/qv4exception.cpp @@ -101,7 +101,7 @@ Exception::Exception(ExecutionContext *throwingContext, const Value &exceptionVa Exception::~Exception() { assert(accepted); - e->exceptionValue = Value::undefinedValue(); + e->exceptionValue = Primitive::undefinedValue(); } void Exception::accept(ExecutionContext *catchingContext) diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 7f4c419ddc..b4c39504f0 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -295,10 +295,10 @@ FunctionPrototype::FunctionPrototype(InternalClass *ic) void FunctionPrototype::init(ExecutionEngine *engine, const Value &ctor) { - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); - defineReadonlyProperty(engine->id_length, Value::fromInt32(0)); + defineReadonlyProperty(engine->id_length, Primitive::fromInt32(0)); defineDefaultProperty(QStringLiteral("constructor"), ctor); defineDefaultProperty(engine->id_toString, method_toString, 0); defineDefaultProperty(QStringLiteral("apply"), method_apply, 2); @@ -349,7 +349,7 @@ ReturnedValue FunctionPrototype::method_apply(SimpleCallContext *ctx) for (quint32 i = 0; i < alen; ++i) callData->args[i] = arr->arrayData[i].value; for (quint32 i = alen; i < len; ++i) - callData->args[i] = Value::undefinedValue(); + callData->args[i] = Primitive::undefinedValue(); } } @@ -415,7 +415,7 @@ ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function) strictMode = function->isStrict(); formalParameterCount = function->formals.size(); formalParameterList = function->formals.constData(); - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(formalParameterCount)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(formalParameterCount)); varCount = function->locals.size(); varList = function->locals.constData(); @@ -514,7 +514,7 @@ SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *fu strictMode = function->isStrict(); formalParameterCount = function->formals.size(); formalParameterList = function->formals.constData(); - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(formalParameterCount)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(formalParameterCount)); varCount = function->locals.size(); varList = function->locals.constData(); @@ -675,7 +675,7 @@ BoundFunction::BoundFunction(ExecutionContext *scope, FunctionObject *target, Va len -= boundArgs.size(); if (len < 0) len = 0; - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(len)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(len)); ExecutionEngine *v4 = scope->engine; diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index d01a989ae1..1b8a6c51ed 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -199,7 +199,7 @@ struct IndexedBuiltinFunction: FunctionObject static ReturnedValue construct(Managed *m, CallData *) { m->engine()->current->throwTypeError(); - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } static ReturnedValue call(Managed *that, CallData *callData); diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 7880b1a69e..014d97a146 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -351,7 +351,7 @@ EvalFunction::EvalFunction(ExecutionContext *scope) : FunctionObject(scope, scope->engine->id_eval) { vtbl = &static_vtbl; - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1)); } ReturnedValue EvalFunction::evalCall(Value /*thisObject*/, Value *args, int argc, bool directCall) diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index bde9c23e6b..b0b5e38ea2 100644 --- a/src/qml/jsruntime/qv4include.cpp +++ b/src/qml/jsruntime/qv4include.cpp @@ -90,11 +90,11 @@ QV4::ReturnedValue QV4Include::resultValue(QV4::ExecutionEngine *v4, Status stat QV4::ScopedObject o(scope, v4->newObject()); QV4::ScopedString s(scope); QV4::ScopedValue v(scope); - o->put((s = v4->newString("OK")), (v = QV4::Value::fromInt32(Ok))); - o->put((s = v4->newString("LOADING")), (v = QV4::Value::fromInt32(Loading))); - o->put((s = v4->newString("NETWORK_ERROR")), (v = QV4::Value::fromInt32(NetworkError))); - o->put((s = v4->newString("EXCEPTION")), (v = QV4::Value::fromInt32(Exception))); - o->put((s = v4->newString("status")), (v = QV4::Value::fromInt32(status))); + o->put((s = v4->newString("OK")), (v = QV4::Primitive::fromInt32(Ok))); + o->put((s = v4->newString("LOADING")), (v = QV4::Primitive::fromInt32(Loading))); + o->put((s = v4->newString("NETWORK_ERROR")), (v = QV4::Primitive::fromInt32(NetworkError))); + o->put((s = v4->newString("EXCEPTION")), (v = QV4::Primitive::fromInt32(Exception))); + o->put((s = v4->newString("status")), (v = QV4::Primitive::fromInt32(status))); return o.asReturnedValue(); } @@ -158,15 +158,15 @@ void QV4Include::finished() try { script.parse(); script.run(); - resultObj->put(status, QV4::ScopedValue(scope, QV4::Value::fromInt32(Ok))); + resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Ok))); } catch (QV4::Exception &e) { e.accept(ctx); - resultObj->put(status, QV4::ScopedValue(scope, QV4::Value::fromInt32(Exception))); + resultObj->put(status, QV4::ScopedValue(scope, QV4::Primitive::fromInt32(Exception))); QV4::ScopedValue ex(scope, e.value()); resultObj->put(QV4::ScopedString(scope, v4->newString("exception")), ex); } } else { - resultObj->put(QV4::ScopedString(scope, v4->newString("status")), QV4::ScopedValue(scope, QV4::Value::fromInt32(NetworkError))); + resultObj->put(QV4::ScopedString(scope, v4->newString("status")), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(NetworkError))); } QV4::ScopedValue cb(scope, m_callbackFunction.value()); @@ -194,7 +194,7 @@ QV4::ReturnedValue QV4Include::method_include(QV4::SimpleCallContext *ctx) QUrl url(ctx->engine->resolvedUrl(ctx->callData->args[0].toQStringNoThrow())); - QV4::Value callbackFunction = QV4::Value::undefinedValue(); + QV4::Value callbackFunction = QV4::Primitive::undefinedValue(); if (ctx->callData->argc >= 2 && ctx->callData->args[1].asFunctionObject()) callbackFunction = ctx->callData->args[1]; diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index c6a0554d40..30313d2714 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -202,7 +202,7 @@ Value JsonParser::parse(QJsonParseError *error) lastError = QJsonParseError::IllegalValue; error->offset = json - head; error->error = lastError; - return Value::undefinedValue(); + return Primitive::undefinedValue(); } // some input left... @@ -210,7 +210,7 @@ Value JsonParser::parse(QJsonParseError *error) lastError = QJsonParseError::IllegalValue; error->offset = json - head; error->error = lastError; - return Value::undefinedValue(); + return Primitive::undefinedValue(); } END; @@ -356,7 +356,7 @@ bool JsonParser::parseValue(ValueRef val) if (*json++ == 'u' && *json++ == 'l' && *json++ == 'l') { - *val = Value::nullValue(); + *val = Primitive::nullValue(); DEBUG << "value: null"; END; return true; @@ -371,7 +371,7 @@ bool JsonParser::parseValue(ValueRef val) if (*json++ == 'r' && *json++ == 'u' && *json++ == 'e') { - *val = Value::fromBoolean(true); + *val = Primitive::fromBoolean(true); DEBUG << "value: true"; END; return true; @@ -387,7 +387,7 @@ bool JsonParser::parseValue(ValueRef val) *json++ == 'l' && *json++ == 's' && *json++ == 'e') { - *val = Value::fromBoolean(false); + *val = Primitive::fromBoolean(false); DEBUG << "value: false"; END; return true; @@ -495,7 +495,7 @@ bool JsonParser::parseNumber(Value *val) bool ok; int n = number.toInt(&ok); if (ok && n < (1<<25) && n > -(1<<25)) { - *val = Value::fromInt32(n); + *val = Primitive::fromInt32(n); END; return true; } @@ -510,7 +510,7 @@ bool JsonParser::parseNumber(Value *val) return false; } - * val = Value::fromDouble(d); + * val = Primitive::fromDouble(d); END; return true; diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index 601b5b9e4b..d71d79e0ef 100644 --- a/src/qml/jsruntime/qv4lookup.cpp +++ b/src/qml/jsruntime/qv4lookup.cpp @@ -135,7 +135,7 @@ ReturnedValue Lookup::getterGeneric(QV4::Lookup *l, const ValueRef object) } } - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } ReturnedValue Lookup::getter0(Lookup *l, const ValueRef object) @@ -182,7 +182,7 @@ ReturnedValue Lookup::getterAccessor0(Lookup *l, const ValueRef object) Scope scope(o->engine()); FunctionObject *getter = o->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); callData->thisObject = *object; @@ -201,7 +201,7 @@ ReturnedValue Lookup::getterAccessor1(Lookup *l, const ValueRef object) Scope scope(o->engine()); FunctionObject *getter = o->prototype()->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); callData->thisObject = *object; @@ -223,7 +223,7 @@ ReturnedValue Lookup::getterAccessor2(Lookup *l, const ValueRef object) Scope scope(o->engine()); FunctionObject *getter = o->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); callData->thisObject = *object; @@ -269,7 +269,7 @@ ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, const ValueRef object) Value res; FunctionObject *getter = o->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); callData->thisObject = *object; @@ -290,7 +290,7 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, const ValueRef object) Value res; FunctionObject *getter = o->prototype()->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); callData->thisObject = *object; @@ -304,7 +304,7 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, const ValueRef object) ReturnedValue Lookup::stringLengthGetter(Lookup *l, const ValueRef object) { if (String *s = object->asString()) - return Value::fromUInt32(s->length()).asReturnedValue(); + return Primitive::fromUInt32(s->length()).asReturnedValue(); l->getter = getterGeneric; return getterGeneric(l, object); @@ -384,10 +384,10 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionContext *ctx) Scope scope(o->engine()); FunctionObject *getter = o->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); return getter->call(callData); } l->globalGetter = globalGetterGeneric; @@ -402,10 +402,10 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionContext *ctx) Scope scope(o->engine()); FunctionObject *getter = o->prototype()->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); return getter->call(callData); } l->globalGetter = globalGetterGeneric; @@ -423,10 +423,10 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionContext *ctx) Scope scope(o->engine()); FunctionObject *getter = o->memberData[l->index].getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); ScopedCallData callData(scope, 0); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); return getter->call(callData); } } diff --git a/src/qml/jsruntime/qv4math_p.h b/src/qml/jsruntime/qv4math_p.h index a3a3715545..9ddb57eaaf 100644 --- a/src/qml/jsruntime/qv4math_p.h +++ b/src/qml/jsruntime/qv4math_p.h @@ -72,8 +72,8 @@ static inline QMLJS_READONLY Value add_int32(int a, int b) : "cc" ); if (!overflow) - return Value::fromInt32(aa); - return Value::fromDouble((double)a + (double)b); + return Primitive::fromInt32(aa); + return Primitive::fromDouble((double)a + (double)b); } static inline QMLJS_READONLY Value sub_int32(int a, int b) @@ -88,8 +88,8 @@ static inline QMLJS_READONLY Value sub_int32(int a, int b) : "cc" ); if (!overflow) - return Value::fromInt32(aa); - return Value::fromDouble((double)a - (double)b); + return Primitive::fromInt32(aa); + return Primitive::fromDouble((double)a - (double)b); } static inline QMLJS_READONLY Value mul_int32(int a, int b) @@ -104,8 +104,8 @@ static inline QMLJS_READONLY Value mul_int32(int a, int b) : "cc" ); if (!overflow) - return Value::fromInt32(aa); - return Value::fromDouble((double)a * (double)b); + return Primitive::fromInt32(aa); + return Primitive::fromDouble((double)a * (double)b); } #else @@ -114,24 +114,24 @@ static inline QMLJS_READONLY Value add_int32(int a, int b) { qint64 result = a + b; if (result > INT_MAX || result < INT_MIN) - return Value::fromDouble(result); - return Value::fromInt32(static_cast(result)); + return Primitive::fromDouble(result); + return Primitive::fromInt32(static_cast(result)); } static inline QMLJS_READONLY Value sub_int32(int a, int b) { qint64 result = a - b; if (result > INT_MAX || result < INT_MIN) - return Value::fromDouble(result); - return Value::fromInt32(static_cast(result)); + return Primitive::fromDouble(result); + return Primitive::fromInt32(static_cast(result)); } static inline QMLJS_READONLY Value mul_int32(int a, int b) { qint64 result = a * b; if (result > INT_MAX || result < INT_MIN) - return Value::fromDouble(result); - return Value::fromInt32(static_cast(result)); + return Primitive::fromDouble(result); + return Primitive::fromInt32(static_cast(result)); } #endif // defined(QMLJS_INLINE_MATH) diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp index 57a84d008a..fcff9e4aca 100644 --- a/src/qml/jsruntime/qv4mathobject.cpp +++ b/src/qml/jsruntime/qv4mathobject.cpp @@ -55,14 +55,14 @@ MathObject::MathObject(ExecutionEngine *engine) { type = Type_MathObject; - defineReadonlyProperty(QStringLiteral("E"), Value::fromDouble(::exp(1.0))); - defineReadonlyProperty(QStringLiteral("LN2"), Value::fromDouble(::log(2.0))); - defineReadonlyProperty(QStringLiteral("LN10"), Value::fromDouble(::log(10.0))); - defineReadonlyProperty(QStringLiteral("LOG2E"), Value::fromDouble(1.0/::log(2.0))); - defineReadonlyProperty(QStringLiteral("LOG10E"), Value::fromDouble(1.0/::log(10.0))); - defineReadonlyProperty(QStringLiteral("PI"), Value::fromDouble(qt_PI)); - defineReadonlyProperty(QStringLiteral("SQRT1_2"), Value::fromDouble(::sqrt(0.5))); - defineReadonlyProperty(QStringLiteral("SQRT2"), Value::fromDouble(::sqrt(2.0))); + defineReadonlyProperty(QStringLiteral("E"), Primitive::fromDouble(::exp(1.0))); + defineReadonlyProperty(QStringLiteral("LN2"), Primitive::fromDouble(::log(2.0))); + defineReadonlyProperty(QStringLiteral("LN10"), Primitive::fromDouble(::log(10.0))); + defineReadonlyProperty(QStringLiteral("LOG2E"), Primitive::fromDouble(1.0/::log(2.0))); + defineReadonlyProperty(QStringLiteral("LOG10E"), Primitive::fromDouble(1.0/::log(10.0))); + defineReadonlyProperty(QStringLiteral("PI"), Primitive::fromDouble(qt_PI)); + defineReadonlyProperty(QStringLiteral("SQRT1_2"), Primitive::fromDouble(::sqrt(0.5))); + defineReadonlyProperty(QStringLiteral("SQRT2"), Primitive::fromDouble(::sqrt(2.0))); defineDefaultProperty(QStringLiteral("abs"), method_abs, 1); defineDefaultProperty(QStringLiteral("acos"), method_acos, 1); diff --git a/src/qml/jsruntime/qv4mm.cpp b/src/qml/jsruntime/qv4mm.cpp index d82968345b..54fee80d72 100644 --- a/src/qml/jsruntime/qv4mm.cpp +++ b/src/qml/jsruntime/qv4mm.cpp @@ -413,7 +413,7 @@ std::size_t MemoryManager::sweep(bool lastSweep) } if (Managed *m = weak->value.asManaged()) { if (!m->markBit) { - weak->value = Value::undefinedValue(); + weak->value = Primitive::undefinedValue(); PersistentValuePrivate *n = weak->next; weak->removeFromList(); weak = n; @@ -555,7 +555,7 @@ MemoryManager::~MemoryManager() PersistentValuePrivate *persistent = m_persistentValues; while (persistent) { PersistentValuePrivate *n = persistent->next; - persistent->value = Value::undefinedValue(); + persistent->value = Primitive::undefinedValue(); persistent->engine = 0; persistent->prev = 0; persistent->next = 0; diff --git a/src/qml/jsruntime/qv4numberobject.cpp b/src/qml/jsruntime/qv4numberobject.cpp index bc5e225f9b..c8169c0706 100644 --- a/src/qml/jsruntime/qv4numberobject.cpp +++ b/src/qml/jsruntime/qv4numberobject.cpp @@ -60,31 +60,31 @@ ReturnedValue NumberCtor::construct(Managed *m, CallData *callData) { Scope scope(m->engine()); double dbl = callData->argc ? callData->args[0].toNumber() : 0.; - ScopedValue d(scope, QV4::Value::fromDouble(dbl)); + ScopedValue d(scope, QV4::Primitive::fromDouble(dbl)); return Encode(m->engine()->newNumberObject(d)); } ReturnedValue NumberCtor::call(Managed *, CallData *callData) { double dbl = callData->argc ? callData->args[0].toNumber() : 0.; - return Value::fromDouble(dbl).asReturnedValue(); + return Primitive::fromDouble(dbl).asReturnedValue(); } void NumberPrototype::init(ExecutionEngine *engine, const Value &ctor) { ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); - ctor.objectValue()->defineReadonlyProperty(QStringLiteral("NaN"), Value::fromDouble(qSNaN())); - ctor.objectValue()->defineReadonlyProperty(QStringLiteral("NEGATIVE_INFINITY"), Value::fromDouble(-qInf())); - ctor.objectValue()->defineReadonlyProperty(QStringLiteral("POSITIVE_INFINITY"), Value::fromDouble(qInf())); - ctor.objectValue()->defineReadonlyProperty(QStringLiteral("MAX_VALUE"), Value::fromDouble(1.7976931348623158e+308)); + ctor.objectValue()->defineReadonlyProperty(QStringLiteral("NaN"), Primitive::fromDouble(qSNaN())); + ctor.objectValue()->defineReadonlyProperty(QStringLiteral("NEGATIVE_INFINITY"), Primitive::fromDouble(-qInf())); + ctor.objectValue()->defineReadonlyProperty(QStringLiteral("POSITIVE_INFINITY"), Primitive::fromDouble(qInf())); + ctor.objectValue()->defineReadonlyProperty(QStringLiteral("MAX_VALUE"), Primitive::fromDouble(1.7976931348623158e+308)); #ifdef __INTEL_COMPILER # pragma warning( push ) # pragma warning(disable: 239) #endif - ctor.objectValue()->defineReadonlyProperty(QStringLiteral("MIN_VALUE"), Value::fromDouble(5e-324)); + ctor.objectValue()->defineReadonlyProperty(QStringLiteral("MIN_VALUE"), Primitive::fromDouble(5e-324)); #ifdef __INTEL_COMPILER # pragma warning( pop ) #endif @@ -157,7 +157,7 @@ ReturnedValue NumberPrototype::method_toString(SimpleCallContext *ctx) } } - String *str = Value::fromDouble(num).toString(ctx); + String *str = Primitive::fromDouble(num).toString(ctx); return Value::fromString(str).asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 78b963e12d..e0c8974440 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -135,7 +135,7 @@ ReturnedValue Object::getValue(const ValueRef thisObject, const Property *p, Pro return p->value.asReturnedValue(); FunctionObject *getter = p->getter(); if (!getter) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); Scope scope(getter->engine()); ScopedCallData callData(scope, 0); @@ -235,7 +235,7 @@ void Object::defineDefaultProperty(const QString &name, ReturnedValue (*code)(Si Scope scope(e); ScopedString s(scope, e->newIdentifier(name)); Scoped function(scope, e->newBuiltinFunction(e->rootContext, s, code)); - function->defineReadonlyProperty(e->id_length, Value::fromInt32(argumentCount)); + function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount)); defineDefaultProperty(s, function.asValue()); } @@ -244,7 +244,7 @@ void Object::defineDefaultProperty(const StringRef name, ReturnedValue (*code)(S ExecutionEngine *e = engine(); Scope scope(e); Scoped function(scope, e->newBuiltinFunction(e->rootContext, name, code)); - function->defineReadonlyProperty(e->id_length, Value::fromInt32(argumentCount)); + function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount)); defineDefaultProperty(name, function.asValue()); } @@ -538,7 +538,7 @@ ReturnedValue Object::getLookup(Managed *m, Lookup *l) return o->getValue(p, attrs); } } - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void Object::setLookup(Managed *m, Lookup *l, const ValueRef value) @@ -710,7 +710,7 @@ ReturnedValue Object::internalGetIndexed(uint index, bool *hasProperty) if (hasProperty) *hasProperty = false; - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } @@ -902,7 +902,7 @@ bool Object::internalDeleteIndexedProperty(uint index) return true; if (!arrayAttributes || arrayAttributes[pidx].isConfigurable()) { - arrayData[pidx].value = Value::undefinedValue(); + arrayData[pidx].value = Primitive::undefinedValue(); if (!arrayAttributes) ensureArrayAttributes(); arrayAttributes[pidx].clear(); @@ -1061,7 +1061,7 @@ bool Object::__defineOwnProperty__(ExecutionContext *ctx, Property *current, con // 9c cattrs.setType(PropertyAttributes::Data); cattrs.setWritable(false); - current->value = Value::undefinedValue(); + current->value = Primitive::undefinedValue(); } } else if (cattrs.isData() && attrs.isData()) { // clause 10 if (!cattrs.isConfigurable() && !cattrs.isWritable()) { @@ -1293,12 +1293,12 @@ void Object::initSparse() arrayAlloc += off; int o = off; for (int i = 0; i < o - 1; ++i) { - arrayData[i].value = Value::fromInt32(i + 1); + arrayData[i].value = Primitive::fromInt32(i + 1); } - arrayData[o - 1].value = Value::fromInt32(arrayDataLen + off); + arrayData[o - 1].value = Primitive::fromInt32(arrayDataLen + off); } for (int i = arrayDataLen + off; i < arrayAlloc; ++i) { - arrayData[i].value = Value::fromInt32(i + 1); + arrayData[i].value = Primitive::fromInt32(i + 1); } } } @@ -1327,7 +1327,7 @@ void Object::arrayReserve(uint n) if (sparseArray) { for (uint i = arrayFreeList; i < arrayAlloc; ++i) { arrayData[i].value = Value::emptyValue(); - arrayData[i].value = Value::fromInt32(i + 1); + arrayData[i].value = Primitive::fromInt32(i + 1); } } else { arrayOffset = 0; @@ -1460,7 +1460,7 @@ ArrayObject::ArrayObject(ExecutionEngine *engine, const QStringList &list) void ArrayObject::init(ExecutionEngine *engine) { type = Type_ArrayObject; - memberData[LengthPropertyIndex].value = Value::fromInt32(0); + memberData[LengthPropertyIndex].value = Primitive::fromInt32(0); } QStringList ArrayObject::toQStringList() const diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index ad06ffb552..3f483b03d9 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -353,14 +353,14 @@ struct BooleanObject: Object { Value value; BooleanObject(ExecutionEngine *engine, const ValueRef value): Object(engine->booleanClass), value(*value) { type = Type_BooleanObject; } protected: - BooleanObject(InternalClass *ic): Object(ic), value(Value::fromBoolean(false)) { type = Type_BooleanObject; } + BooleanObject(InternalClass *ic): Object(ic), value(Primitive::fromBoolean(false)) { type = Type_BooleanObject; } }; struct NumberObject: Object { Value value; NumberObject(ExecutionEngine *engine, const ValueRef value): Object(engine->numberClass), value(*value) { type = Type_NumberObject; } protected: - NumberObject(InternalClass *ic): Object(ic), value(Value::fromInt32(0)) { type = Type_NumberObject; } + NumberObject(InternalClass *ic): Object(ic), value(Primitive::fromInt32(0)) { type = Type_NumberObject; } }; struct ArrayObject: Object { @@ -395,7 +395,7 @@ inline void Object::setArrayLengthUnchecked(uint l) if (isArrayObject()) { // length is always the first property of an array Property &lengthProperty = memberData[ArrayObject::LengthPropertyIndex]; - lengthProperty.value = Value::fromUInt32(l); + lengthProperty.value = Primitive::fromUInt32(l); } } diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index a9c9e817f7..1c12704545 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -53,7 +53,7 @@ ObjectIterator::ObjectIterator(Object *o, uint flags) , memberIndex(0) , flags(flags) { - tmpDynamicProperty.value = Value::undefinedValue(); + tmpDynamicProperty.value = Primitive::undefinedValue(); } Property *ObjectIterator::next(String **name, uint *index, PropertyAttributes *attrs) diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 96426cabfb..bf16073f61 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -106,7 +106,7 @@ void ObjectPrototype::init(ExecutionEngine *v4, const Value &ctor) Scope scope(v4); ctor.objectValue()->defineReadonlyProperty(v4->id_prototype, Value::fromObject(this)); - ctor.objectValue()->defineReadonlyProperty(v4->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(v4->id_length, Primitive::fromInt32(1)); ctor.objectValue()->defineDefaultProperty(QStringLiteral("getPrototypeOf"), method_getPrototypeOf, 1); ctor.objectValue()->defineDefaultProperty(QStringLiteral("getOwnPropertyDescriptor"), method_getOwnPropertyDescriptor, 2); ctor.objectValue()->defineDefaultProperty(QStringLiteral("getOwnPropertyNames"), method_getOwnPropertyNames, 1); @@ -586,7 +586,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope ctx->throwTypeError(); attrs->setWritable(Value::fromReturnedValue(o->get(ctx->engine->id_writable)).toBoolean()); // writable forces it to be a data descriptor - desc->value = Value::undefinedValue(); + desc->value = Primitive::undefinedValue(); } if (o->__hasProperty__(ctx->engine->id_value)) { @@ -618,21 +618,21 @@ ReturnedValue ObjectPrototype::fromPropertyDescriptor(ExecutionContext *ctx, con pd.value = desc->value; s = engine->newString(QStringLiteral("value")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); - pd.value = Value::fromBoolean(attrs.isWritable()); + pd.value = Primitive::fromBoolean(attrs.isWritable()); s = engine->newString(QStringLiteral("writable")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); } else { - pd.value = desc->getter() ? Value::fromObject(desc->getter()) : Value::undefinedValue(); + pd.value = desc->getter() ? Value::fromObject(desc->getter()) : Primitive::undefinedValue(); s = engine->newString(QStringLiteral("get")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); - pd.value = desc->setter() ? Value::fromObject(desc->setter()) : Value::undefinedValue(); + pd.value = desc->setter() ? Value::fromObject(desc->setter()) : Primitive::undefinedValue(); s = engine->newString(QStringLiteral("set")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); } - pd.value = Value::fromBoolean(attrs.isEnumerable()); + pd.value = Primitive::fromBoolean(attrs.isEnumerable()); s = engine->newString(QStringLiteral("enumerable")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); - pd.value = Value::fromBoolean(attrs.isConfigurable()); + pd.value = Primitive::fromBoolean(attrs.isConfigurable()); s = engine->newString(QStringLiteral("configurable")); o->__defineOwnProperty__(ctx, s, pd, Attr_Data); diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h index 024ad3c720..258a190602 100644 --- a/src/qml/jsruntime/qv4property_p.h +++ b/src/qml/jsruntime/qv4property_p.h @@ -63,7 +63,7 @@ struct Property { // Section 8.10 inline void fullyPopulated(PropertyAttributes *attrs) { if (!attrs->hasType()) { - value = Value::undefinedValue(); + value = Primitive::undefinedValue(); } if (attrs->type() == PropertyAttributes::Accessor) { attrs->clearWritable(); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 876bda3163..a1b8012a13 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -850,8 +850,8 @@ ReturnedValue QObjectWrapper::method_disconnect(SimpleCallContext *ctx) if (signalIndex < 0 || signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal) V4THROW_ERROR("Function.prototype.disconnect: this object is not a signal"); - QV4::Value functionValue = QV4::Value::undefinedValue(); - QV4::Value functionThisValue = QV4::Value::undefinedValue(); + QV4::Value functionValue = QV4::Primitive::undefinedValue(); + QV4::Value functionThisValue = QV4::Primitive::undefinedValue(); if (ctx->callData->argc == 1) { functionValue = ctx->callData->args[0]; @@ -1745,7 +1745,7 @@ ReturnedValue QObjectMethod::callInternal(CallData *callData) } if (method.isV4Function()) { - QV4::ScopedValue rv(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue rv(scope, QV4::Primitive::undefinedValue()); QV4::ScopedValue qmlGlobal(scope, m_qmlGlobal.value()); QQmlV4Function func(callData, rv, qmlGlobal, diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index ea2dccccbc..ce0c206a18 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -126,7 +126,7 @@ struct QObjectMethod : public QV4::FunctionObject enum { DestroyMethod = -1, ToStringMethod = -2 }; - static Value create(QV4::ExecutionContext *scope, QObject *object, int index, const Value &qmlGlobal = Value::undefinedValue()); + static Value create(QV4::ExecutionContext *scope, QObject *object, int index, const Value &qmlGlobal = Primitive::undefinedValue()); int methodIndex() const { return m_index; } QObject *object() const { return m_object.data(); } diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp index 9534162ecd..3d9572eb5a 100644 --- a/src/qml/jsruntime/qv4regexp.cpp +++ b/src/qml/jsruntime/qv4regexp.cpp @@ -138,12 +138,12 @@ void RegExp::markObjects(Managed *that) ReturnedValue RegExp::get(Managed *, const StringRef, bool *) { - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } ReturnedValue RegExp::getIndexed(Managed *m, uint index, bool *hasProperty) { - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void RegExp::put(Managed *m, const StringRef name, const ValueRef value) diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index fee66d9d09..d9e8b2419b 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -147,7 +147,7 @@ void RegExpObject::init(ExecutionEngine *engine) ScopedString lastIndex(scope, engine->newIdentifier(QStringLiteral("lastIndex"))); Property *lastIndexProperty = insertMember(lastIndex, Attr_NotEnumerable|Attr_NotConfigurable); - lastIndexProperty->value = Value::fromInt32(0); + lastIndexProperty->value = Primitive::fromInt32(0); if (!this->value) return; @@ -160,9 +160,9 @@ void RegExpObject::init(ExecutionEngine *engine) } defineReadonlyProperty(QStringLiteral("source"), Value::fromString(engine->newString(p))); - defineReadonlyProperty(QStringLiteral("global"), Value::fromBoolean(global)); - defineReadonlyProperty(QStringLiteral("ignoreCase"), Value::fromBoolean(this->value->ignoreCase())); - defineReadonlyProperty(QStringLiteral("multiline"), Value::fromBoolean(this->value->multiLine())); + defineReadonlyProperty(QStringLiteral("global"), Primitive::fromBoolean(global)); + defineReadonlyProperty(QStringLiteral("ignoreCase"), Primitive::fromBoolean(this->value->ignoreCase())); + defineReadonlyProperty(QStringLiteral("multiline"), Primitive::fromBoolean(this->value->multiLine())); } @@ -240,8 +240,8 @@ ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) ExecutionContext *ctx = m->engine()->current; Scope scope(ctx); - ScopedValue r(scope, callData->argc > 0 ? callData->args[0] : Value::undefinedValue()); - ScopedValue f(scope, callData->argc > 1 ? callData->args[1] : Value::undefinedValue()); + ScopedValue r(scope, callData->argc > 0 ? callData->args[0] : Primitive::undefinedValue()); + ScopedValue f(scope, callData->argc > 1 ? callData->args[1] : Primitive::undefinedValue()); if (RegExpObject *re = r->as()) { if (!f->isUndefined()) ctx->throwTypeError(); @@ -292,7 +292,7 @@ ReturnedValue RegExpCtor::call(Managed *that, CallData *callData) void RegExpPrototype::init(ExecutionEngine *engine, const Value &ctor) { ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(2)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(2)); defineDefaultProperty(QStringLiteral("constructor"), ctor); defineDefaultProperty(QStringLiteral("exec"), method_exec, 1); defineDefaultProperty(QStringLiteral("test"), method_test, 1); @@ -313,14 +313,14 @@ ReturnedValue RegExpPrototype::method_exec(SimpleCallContext *ctx) int offset = r->global ? r->lastIndexProperty(ctx)->value.toInt32() : 0; if (offset < 0 || offset > s.length()) { - r->lastIndexProperty(ctx)->value = Value::fromInt32(0); + r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0); return Encode::null(); } uint* matchOffsets = (uint*)alloca(r->value->captureCount() * 2 * sizeof(uint)); int result = r->value->match(s, offset, matchOffsets); if (result == -1) { - r->lastIndexProperty(ctx)->value = Value::fromInt32(0); + r->lastIndexProperty(ctx)->value = Primitive::fromInt32(0); return Encode::null(); } @@ -331,16 +331,16 @@ ReturnedValue RegExpPrototype::method_exec(SimpleCallContext *ctx) for (int i = 0; i < len; ++i) { int start = matchOffsets[i * 2]; int end = matchOffsets[i * 2 + 1]; - array->arrayData[i].value = (start != -1 && end != -1) ? Value::fromString(ctx, s.mid(start, end - start)) : Value::undefinedValue(); + array->arrayData[i].value = (start != -1 && end != -1) ? Value::fromString(ctx, s.mid(start, end - start)) : Primitive::undefinedValue(); array->arrayDataLen = i + 1; } array->setArrayLengthUnchecked(len); - array->memberData[Index_ArrayIndex].value = Value::fromInt32(result); + array->memberData[Index_ArrayIndex].value = Primitive::fromInt32(result); array->memberData[Index_ArrayInput].value = arg; if (r->global) - r->lastIndexProperty(ctx)->value = Value::fromInt32(matchOffsets[1]); + r->lastIndexProperty(ctx)->value = Primitive::fromInt32(matchOffsets[1]); return array.asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 687f083a80..ec164500cc 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -255,7 +255,7 @@ ReturnedValue __qmljs_delete_subscript(ExecutionContext *ctx, const ValueRef bas if (o) { uint n = index->asArrayIndex(); if (n < UINT_MAX) { - return Value::fromBoolean(o->deleteIndexedProperty(n)).asReturnedValue(); + return Primitive::fromBoolean(o->deleteIndexedProperty(n)).asReturnedValue(); } } @@ -291,7 +291,7 @@ QV4::ReturnedValue __qmljs_add_helper(ExecutionContext *ctx, const ValueRef left } double x = __qmljs_to_number(pleft); double y = __qmljs_to_number(pright); - return Value::fromDouble(x + y).asReturnedValue(); + return Primitive::fromDouble(x + y).asReturnedValue(); } QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right) @@ -301,7 +301,7 @@ QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left ctx->throwTypeError(); bool r = o->hasInstance(left); - return Value::fromBoolean(r).asReturnedValue(); + return Primitive::fromBoolean(r).asReturnedValue(); } QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const ValueRef right) @@ -311,7 +311,7 @@ QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const Scope scope(ctx); ScopedString s(scope, left->toString(ctx)); bool r = right->objectValue()->__hasProperty__(s); - return Value::fromBoolean(r).asReturnedValue(); + return Primitive::fromBoolean(r).asReturnedValue(); } static void inplaceBitOp(ExecutionContext *ctx, const StringRef name, const ValueRef value, BinOp op) @@ -602,7 +602,7 @@ ReturnedValue __qmljs_object_default_value(Object *object, int typeHint) } ctx->throwTypeError(); - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } Bool __qmljs_to_boolean(const ValueRef value) @@ -675,7 +675,7 @@ ReturnedValue __qmljs_get_element(ExecutionContext *ctx, const ValueRef object, if (idx < UINT_MAX) { if (String *str = object->asString()) { if (idx >= (uint)str->toQString().length()) { - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } const QString s = str->toQString().mid(idx, 1); return Value::fromString(ctx, s).asReturnedValue(); @@ -814,10 +814,10 @@ uint __qmljs_equal_helper(const ValueRef x, const ValueRef y) double dx = __qmljs_to_number(x); return dx == y->asDouble(); } else if (x->isBoolean()) { - Value nx = Value::fromDouble((double) x->booleanValue()); + Value nx = Primitive::fromDouble((double) x->booleanValue()); return __qmljs_cmp_eq(ValueRef(&nx), y); } else if (y->isBoolean()) { - Value ny = Value::fromDouble((double) y->booleanValue()); + Value ny = Primitive::fromDouble((double) y->booleanValue()); return __qmljs_cmp_eq(x, ValueRef(&ny)); } else if ((x->isNumber() || x->isString()) && y->isObject()) { Scope scope(y->objectValue()->engine()); @@ -1175,7 +1175,7 @@ void __qmljs_builtin_define_property(ExecutionContext *ctx, const ValueRef objec uint idx = name->asArrayIndex(); Property *pd = (idx != UINT_MAX) ? o->arrayInsert(idx) : o->insertMember(name, Attr_Data); - pd->value = val ? *val : Value::undefinedValue(); + pd->value = val ? *val : Primitive::undefinedValue(); } ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values, uint length) @@ -1192,7 +1192,7 @@ ReturnedValue __qmljs_builtin_define_array(ExecutionContext *ctx, Value *values, for (uint i = 0; i < length; ++i) { if (values[i].isEmpty()) { a->ensureArrayAttributes(); - pd->value = Value::undefinedValue(); + pd->value = Primitive::undefinedValue(); a->arrayAttributes[i].clear(); } else { pd->value = values[i]; @@ -1249,10 +1249,10 @@ QV4::ReturnedValue __qmljs_increment(const QV4::ValueRef value) TRACE1(value); if (value->isInteger()) - return Value::fromInt32(value->integerValue() + 1).asReturnedValue(); + return Primitive::fromInt32(value->integerValue() + 1).asReturnedValue(); else { double d = value->toNumber(); - return Value::fromDouble(d + 1).asReturnedValue(); + return Primitive::fromDouble(d + 1).asReturnedValue(); } } @@ -1261,10 +1261,10 @@ QV4::ReturnedValue __qmljs_decrement(const QV4::ValueRef value) TRACE1(value); if (value->isInteger()) - return Value::fromInt32(value->integerValue() - 1).asReturnedValue(); + return Primitive::fromInt32(value->integerValue() - 1).asReturnedValue(); else { double d = value->toNumber(); - return Value::fromDouble(d - 1).asReturnedValue(); + return Primitive::fromDouble(d - 1).asReturnedValue(); } } diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index 6b3325898c..a9e8e01232 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -311,10 +311,10 @@ inline QV4::ReturnedValue __qmljs_uminus(const QV4::ValueRef value) // +0 != -0, so we need to convert to double when negating 0 if (value->isInteger() && value->integerValue()) - return QV4::Value::fromInt32(-value->integerValue()).asReturnedValue(); + return QV4::Primitive::fromInt32(-value->integerValue()).asReturnedValue(); else { double n = __qmljs_to_number(value); - return QV4::Value::fromDouble(-n).asReturnedValue(); + return QV4::Primitive::fromDouble(-n).asReturnedValue(); } } @@ -345,11 +345,11 @@ inline ReturnedValue __qmljs_bit_or(const QV4::ValueRef left, const QV4::ValueRe TRACE2(left, right); if (QV4::Value::integerCompatible(*left, *right)) - return QV4::Value::fromInt32(left->integerValue() | right->integerValue()).asReturnedValue(); + return QV4::Primitive::fromInt32(left->integerValue() | right->integerValue()).asReturnedValue(); int lval = left->toInt32(); int rval = right->toInt32(); - return QV4::Value::fromInt32(lval | rval).asReturnedValue(); + return QV4::Primitive::fromInt32(lval | rval).asReturnedValue(); } inline ReturnedValue __qmljs_bit_xor(const QV4::ValueRef left, const QV4::ValueRef right) @@ -357,11 +357,11 @@ inline ReturnedValue __qmljs_bit_xor(const QV4::ValueRef left, const QV4::ValueR TRACE2(left, right); if (QV4::Value::integerCompatible(*left, *right)) - return QV4::Value::fromInt32(left->integerValue() ^ right->integerValue()).asReturnedValue(); + return QV4::Primitive::fromInt32(left->integerValue() ^ right->integerValue()).asReturnedValue(); int lval = left->toInt32(); int rval = right->toInt32(); - return QV4::Value::fromInt32(lval ^ rval).asReturnedValue(); + return QV4::Primitive::fromInt32(lval ^ rval).asReturnedValue(); } inline ReturnedValue __qmljs_bit_and(const QV4::ValueRef left, const QV4::ValueRef right) @@ -369,11 +369,11 @@ inline ReturnedValue __qmljs_bit_and(const QV4::ValueRef left, const QV4::ValueR TRACE2(left, right); if (QV4::Value::integerCompatible(*left, *right)) - return QV4::Value::fromInt32(left->integerValue() & right->integerValue()).asReturnedValue(); + return QV4::Primitive::fromInt32(left->integerValue() & right->integerValue()).asReturnedValue(); int lval = left->toInt32(); int rval = right->toInt32(); - return QV4::Value::fromInt32(lval & rval).asReturnedValue(); + return QV4::Primitive::fromInt32(lval & rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_add(QV4::ExecutionContext *ctx, const QV4::ValueRef left, const QV4::ValueRef right) @@ -384,7 +384,7 @@ inline QV4::ReturnedValue __qmljs_add(QV4::ExecutionContext *ctx, const QV4::Val return add_int32(left->integerValue(), right->integerValue()).asReturnedValue(); if (QV4::Value::bothDouble(*left, *right)) - return QV4::Value::fromDouble(left->doubleValue() + right->doubleValue()).asReturnedValue(); + return QV4::Primitive::fromDouble(left->doubleValue() + right->doubleValue()).asReturnedValue(); return __qmljs_add_helper(ctx, left, right); } @@ -398,7 +398,7 @@ inline QV4::ReturnedValue __qmljs_sub(const QV4::ValueRef left, const QV4::Value double lval = __qmljs_to_number(left); double rval = __qmljs_to_number(right); - return QV4::Value::fromDouble(lval - rval).asReturnedValue(); + return QV4::Primitive::fromDouble(lval - rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_mul(const QV4::ValueRef left, const QV4::ValueRef right) @@ -410,7 +410,7 @@ inline QV4::ReturnedValue __qmljs_mul(const QV4::ValueRef left, const QV4::Value double lval = __qmljs_to_number(left); double rval = __qmljs_to_number(right); - return QV4::Value::fromDouble(lval * rval).asReturnedValue(); + return QV4::Primitive::fromDouble(lval * rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_div(const QV4::ValueRef left, const QV4::ValueRef right) @@ -419,7 +419,7 @@ inline QV4::ReturnedValue __qmljs_div(const QV4::ValueRef left, const QV4::Value double lval = __qmljs_to_number(left); double rval = __qmljs_to_number(right); - return QV4::Value::fromDouble(lval / rval).asReturnedValue(); + return QV4::Primitive::fromDouble(lval / rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_mod(const QV4::ValueRef left, const QV4::ValueRef right) @@ -429,12 +429,12 @@ inline QV4::ReturnedValue __qmljs_mod(const QV4::ValueRef left, const QV4::Value if (QV4::Value::integerCompatible(*left, *right) && right->integerValue() != 0) { int intRes = left->integerValue() % right->integerValue(); if (intRes != 0 || left->integerValue() >= 0) - return QV4::Value::fromInt32(intRes).asReturnedValue(); + return QV4::Primitive::fromInt32(intRes).asReturnedValue(); } double lval = __qmljs_to_number(left); double rval = __qmljs_to_number(right); - return QV4::Value::fromDouble(std::fmod(lval, rval)).asReturnedValue(); + return QV4::Primitive::fromDouble(std::fmod(lval, rval)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_shl(const QV4::ValueRef left, const QV4::ValueRef right) @@ -442,11 +442,11 @@ inline QV4::ReturnedValue __qmljs_shl(const QV4::ValueRef left, const QV4::Value TRACE2(left, right); if (QV4::Value::integerCompatible(*left, *right)) - return QV4::Value::fromInt32(left->integerValue() << ((uint(right->integerValue()) & 0x1f))).asReturnedValue(); + return QV4::Primitive::fromInt32(left->integerValue() << ((uint(right->integerValue()) & 0x1f))).asReturnedValue(); int lval = left->toInt32(); unsigned rval = right->toUInt32() & 0x1f; - return QV4::Value::fromInt32(lval << rval).asReturnedValue(); + return QV4::Primitive::fromInt32(lval << rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_shr(const QV4::ValueRef left, const QV4::ValueRef right) @@ -454,11 +454,11 @@ inline QV4::ReturnedValue __qmljs_shr(const QV4::ValueRef left, const QV4::Value TRACE2(left, right); if (QV4::Value::integerCompatible(*left, *right)) - return QV4::Value::fromInt32(left->integerValue() >> ((uint(right->integerValue()) & 0x1f))).asReturnedValue(); + return QV4::Primitive::fromInt32(left->integerValue() >> ((uint(right->integerValue()) & 0x1f))).asReturnedValue(); int lval = left->toInt32(); unsigned rval = right->toUInt32() & 0x1f; - return QV4::Value::fromInt32(lval >> rval).asReturnedValue(); + return QV4::Primitive::fromInt32(lval >> rval).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_ushr(const QV4::ValueRef left, const QV4::ValueRef right) @@ -475,51 +475,51 @@ inline QV4::ReturnedValue __qmljs_ushr(const QV4::ValueRef left, const QV4::Valu } if (res > INT_MAX) - return QV4::Value::fromDouble(res).asReturnedValue(); + return QV4::Primitive::fromDouble(res).asReturnedValue(); else - return QV4::Value::fromInt32(res).asReturnedValue(); + return QV4::Primitive::fromInt32(res).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_gt(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(__qmljs_cmp_gt(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(__qmljs_cmp_gt(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_lt(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(__qmljs_cmp_lt(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(__qmljs_cmp_lt(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_ge(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(__qmljs_cmp_ge(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(__qmljs_cmp_ge(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_le(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(__qmljs_cmp_le(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(__qmljs_cmp_le(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_eq(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(__qmljs_cmp_eq(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(__qmljs_cmp_eq(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_ne(const QV4::ValueRef left, const QV4::ValueRef right) { TRACE2(left, right); - return QV4::Value::fromBoolean(!__qmljs_cmp_eq(left, right)).asReturnedValue(); + return QV4::Primitive::fromBoolean(!__qmljs_cmp_eq(left, right)).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_se(const QV4::ValueRef left, const QV4::ValueRef right) @@ -527,7 +527,7 @@ inline QV4::ReturnedValue __qmljs_se(const QV4::ValueRef left, const QV4::ValueR TRACE2(left, right); bool r = __qmljs_strict_equal(left, right); - return QV4::Value::fromBoolean(r).asReturnedValue(); + return QV4::Primitive::fromBoolean(r).asReturnedValue(); } inline QV4::ReturnedValue __qmljs_sne(const QV4::ValueRef left, const QV4::ValueRef right) @@ -535,7 +535,7 @@ inline QV4::ReturnedValue __qmljs_sne(const QV4::ValueRef left, const QV4::Value TRACE2(left, right); bool r = ! __qmljs_strict_equal(left, right); - return QV4::Value::fromBoolean(r).asReturnedValue(); + return QV4::Primitive::fromBoolean(r).asReturnedValue(); } inline QV4::Bool __qmljs_cmp_eq(const QV4::ValueRef left, const QV4::ValueRef right) diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 30b53e7e49..4c44d37af8 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -137,7 +137,7 @@ struct ScopedValue ScopedValue(const Scope &scope, Returned *t) { ptr = scope.engine->jsStackTop++; - *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Value::undefinedValue(); + *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Primitive::undefinedValue(); #ifndef QT_NO_DEBUG ++scope.size; #endif @@ -160,7 +160,7 @@ struct ScopedValue template ScopedValue &operator=(Returned *t) { - *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Value::undefinedValue(); + *ptr = t->getPointer() ? Value::fromManaged(t->getPointer()) : Primitive::undefinedValue(); return *this; } @@ -196,7 +196,7 @@ struct Scoped #if QT_POINTER_SIZE == 8 ptr->val = (quint64)p; #else - *ptr = p ? QV4::Value::fromManaged(p) : QV4::Value::undefinedValue(); + *ptr = p ? QV4::Value::fromManaged(p) : QV4::Primitive::undefinedValue(); #endif } @@ -327,16 +327,14 @@ struct Scoped } Value asValue() const { -#if QT_POINTER_SIZE == 8 - return ptr->val ? *ptr : QV4::Value::undefinedValue(); -#else - return *ptr; -#endif + if (ptr->m) + return *ptr; + return QV4::Primitive::undefinedValue(); } ReturnedValue asReturnedValue() const { #if QT_POINTER_SIZE == 8 - return ptr->val ? ptr->val : Value::undefinedValue().asReturnedValue(); + return ptr->val ? ptr->val : Primitive::undefinedValue().asReturnedValue(); #else return ptr->val; #endif @@ -478,7 +476,7 @@ struct Referenced { T *getPointer() const { return static_cast(ptr->managed()); } - ReturnedValue asReturnedValue() const { return ptr ? ptr->val : Value::undefinedValue().asReturnedValue(); } + ReturnedValue asReturnedValue() const { return ptr ? ptr->val : Primitive::undefinedValue().asReturnedValue(); } static Referenced null() { return Referenced(Null); } bool isNull() const { return !ptr; } @@ -654,6 +652,11 @@ inline Safe::operator Returned *() return Returned::create(static_cast(managed())); } +inline Primitive::operator ValueRef() +{ + return ValueRef(this); +} + template PersistentValue::PersistentValue(Returned *obj) @@ -693,7 +696,7 @@ inline WeakValue &WeakValue::operator=(Returned *obj) } inline ReturnedValue SimpleCallContext::argument(int i) { - return i < callData->argc ? callData->args[i].asReturnedValue() : Value::undefinedValue().asReturnedValue(); + return i < callData->argc ? callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue(); } diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 7a19e385a1..d358c8948c 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -69,7 +69,7 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Objec function->compilationUnit->ref(); usesArgumentsObject = function->usesArgumentsObject(); needsActivation = function->needsActivation(); - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1)); qmlContext = scope->engine->current->newQmlContext(this, qml); scope->engine->popContext(); @@ -83,7 +83,7 @@ QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Object *qml) function = 0; usesArgumentsObject = false; needsActivation = false; - defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1)); + defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1)); qmlContext = scope->engine->current->newQmlContext(this, qml); scope->engine->popContext(); @@ -97,7 +97,7 @@ ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *) Q_ASSERT(This->function); CallContext *ctx = This->qmlContext; - std::fill(ctx->locals, ctx->locals + ctx->function->varCount, Value::undefinedValue()); + std::fill(ctx->locals, ctx->locals + ctx->function->varCount, Primitive::undefinedValue()); engine->pushContext(ctx); ScopedValue result(scope, This->function->code(ctx, This->function->codeData)); engine->popContext(); @@ -252,7 +252,7 @@ ReturnedValue Script::run() ScopedObject qmlObj(valueScope, qml.value()); FunctionObject *f = new (engine->memoryManager) QmlBindingWrapper(scope, vmFunction, qmlObj.getPointer()); ScopedCallData callData(valueScope, 0); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); return f->call(callData); } } diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 6ad13efbdd..4ec5644352 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -86,7 +86,7 @@ static QV4::Value convertElementToValue(QV4::ExecutionEngine *engine, const QStr static QV4::Value convertElementToValue(QV4::ExecutionEngine *, int element) { - return QV4::Value::fromInt32(element); + return QV4::Primitive::fromInt32(element); } static QV4::Value convertElementToValue(QV4::ExecutionEngine *engine, const QUrl &element) @@ -96,12 +96,12 @@ static QV4::Value convertElementToValue(QV4::ExecutionEngine *engine, const QUrl static QV4::Value convertElementToValue(QV4::ExecutionEngine *, qreal element) { - return QV4::Value::fromDouble(element); + return QV4::Primitive::fromDouble(element); } static QV4::Value convertElementToValue(QV4::ExecutionEngine *, bool element) { - return QV4::Value::fromBoolean(element); + return QV4::Primitive::fromBoolean(element); } static QString convertElementToString(const QString &element) @@ -202,13 +202,13 @@ public: generateWarning(engine()->current, QLatin1String("Index out of range during indexed get")); if (hasProperty) *hasProperty = false; - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); } if (m_isReference) { if (!m_object) { if (hasProperty) *hasProperty = false; - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); } loadReference(); } @@ -220,7 +220,7 @@ public: } if (hasProperty) *hasProperty = false; - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); } void containerPutIndexed(uint index, const QV4::ValueRef value) diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp index ef2ca8bfc8..a8dd865840 100644 --- a/src/qml/jsruntime/qv4serialize.cpp +++ b/src/qml/jsruntime/qv4serialize.cpp @@ -251,7 +251,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, QV8Engine *engi } reserve(data, sizeof(quint32) + length * sizeof(quint32)); push(data, valueheader(WorkerSequence, length)); - serialize(data, QV4::Value::fromInt32(QV4::SequencePrototype::metaTypeForSequence(o)), engine); // sequence type + serialize(data, QV4::Primitive::fromInt32(QV4::SequencePrototype::metaTypeForSequence(o)), engine); // sequence type for (uint32_t ii = 0; ii < seqLength; ++ii) serialize(data, QV4::Value::fromReturnedValue(o->getIndexed(ii)), engine); // sequence elements @@ -350,7 +350,7 @@ ReturnedValue Serialize::deserialize(const char *&data, QV8Engine *engine) case WorkerNumber: return QV4::Encode(popDouble(data)); case WorkerDate: - return QV4::Encode(v4->newDateObject(QV4::Value::fromDouble(popDouble(data)))); + return QV4::Encode(v4->newDateObject(QV4::Primitive::fromDouble(popDouble(data)))); case WorkerRegexp: { quint32 flags = headersize(header); diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp index a001dc276b..a9faf634c9 100644 --- a/src/qml/jsruntime/qv4sparsearray.cpp +++ b/src/qml/jsruntime/qv4sparsearray.cpp @@ -66,7 +66,7 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co Scope scope(o->engine()); ScopedValue result(scope); ScopedCallData callData(scope, 2); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); callData->args[0] = p1.value; callData->args[1] = p2.value; result = __qmljs_call_value(m_context, m_comparefn, callData); diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index e70bf7d626..eadb523532 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -138,14 +138,14 @@ ReturnedValue String::get(Managed *m, const StringRef name, bool *hasProperty) if (name->isEqualTo(v4->id_length)) { if (hasProperty) *hasProperty = true; - return Value::fromInt32(that->_text.length()).asReturnedValue(); + return Primitive::fromInt32(that->_text.length()).asReturnedValue(); } PropertyAttributes attrs; Property *pd = v4->stringClass->prototype->__getPropertyDescriptor__(name, &attrs); if (!pd || attrs.isGeneric()) { if (hasProperty) *hasProperty = false; - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } if (hasProperty) *hasProperty = true; @@ -168,7 +168,7 @@ ReturnedValue String::getIndexed(Managed *m, uint index, bool *hasProperty) if (!pd || attrs.isGeneric()) { if (hasProperty) *hasProperty = false; - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } if (hasProperty) *hasProperty = true; diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 05a1ef4100..78b5af1313 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -83,9 +83,9 @@ StringObject::StringObject(InternalClass *ic) vtbl = &static_vtbl; type = Type_StringObject; - tmpProperty.value = Value::undefinedValue(); + tmpProperty.value = Primitive::undefinedValue(); - defineReadonlyProperty(ic->engine->id_length, Value::fromInt32(0)); + defineReadonlyProperty(ic->engine->id_length, Primitive::fromInt32(0)); } StringObject::StringObject(ExecutionEngine *engine, const Value &value) @@ -94,10 +94,10 @@ StringObject::StringObject(ExecutionEngine *engine, const Value &value) vtbl = &static_vtbl; type = Type_StringObject; - tmpProperty.value = Value::undefinedValue(); + tmpProperty.value = Primitive::undefinedValue(); assert(value.isString()); - defineReadonlyProperty(engine->id_length, Value::fromUInt32(value.stringValue()->toQString().length())); + defineReadonlyProperty(engine->id_length, Primitive::fromUInt32(value.stringValue()->toQString().length())); } Property *StringObject::getIndex(uint index) const @@ -189,7 +189,7 @@ ReturnedValue StringCtor::call(Managed *m, CallData *callData) void StringPrototype::init(ExecutionEngine *engine, const Value &ctor) { ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this)); - ctor.objectValue()->defineReadonlyProperty(engine->id_length, Value::fromInt32(1)); + ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(1)); ctor.objectValue()->defineDefaultProperty(QStringLiteral("fromCharCode"), method_fromCharCode, 1); defineDefaultProperty(QStringLiteral("constructor"), ctor); @@ -333,7 +333,7 @@ ReturnedValue StringPrototype::method_lastIndexOf(SimpleCallContext *context) ReturnedValue StringPrototype::method_localeCompare(SimpleCallContext *context) { const QString value = getThisString(context); - const QString that = (context->callData->argc ? context->callData->args[0] : Value::undefinedValue()).toQString(); + const QString that = (context->callData->argc ? context->callData->args[0] : Primitive::undefinedValue()).toQString(); return Encode(QString::localeAwareCompare(value, that)); } @@ -345,7 +345,7 @@ ReturnedValue StringPrototype::method_match(SimpleCallContext *context) Scope scope(context); ScopedString s(scope, context->callData->thisObject.toString(context)); - ScopedValue regexp(scope, context->callData->argc ? context->callData->args[0] : Value::undefinedValue()); + ScopedValue regexp(scope, context->callData->argc ? context->callData->args[0] : Primitive::undefinedValue()); Scoped rx(scope, regexp); if (!rx) { ScopedCallData callData(scope, 1); @@ -370,7 +370,7 @@ ReturnedValue StringPrototype::method_match(SimpleCallContext *context) return exec->call(callData); ScopedString lastIndex(scope, context->engine->newString(QStringLiteral("lastIndex"))); - rx->put(lastIndex, ScopedValue(scope, Value::fromInt32(0))); + rx->put(lastIndex, ScopedValue(scope, Primitive::fromInt32(0))); Scoped a(scope, context->engine->newArrayObject()); double previousLastIndex = 0; @@ -387,7 +387,7 @@ ReturnedValue StringPrototype::method_match(SimpleCallContext *context) double thisIndex = index->toInteger(); if (previousLastIndex == thisIndex) { previousLastIndex = thisIndex + 1; - rx->put(lastIndex, ScopedValue(scope, Value::fromDouble(previousLastIndex))); + rx->put(lastIndex, ScopedValue(scope, Primitive::fromDouble(previousLastIndex))); } else { previousLastIndex = thisIndex; } @@ -488,7 +488,7 @@ ReturnedValue StringPrototype::method_replace(SimpleCallContext *ctx) offset = qMax(offset + 1, matchOffsets[oldSize + 1]); } if (regExp->global) - regExp->lastIndexProperty(ctx)->value = Value::fromUInt32(0); + regExp->lastIndexProperty(ctx)->value = Primitive::fromUInt32(0); numStringMatches = nMatchOffsets / (regExp->value->captureCount() * 2); numCaptures = regExp->value->captureCount(); } else { @@ -510,14 +510,14 @@ ReturnedValue StringPrototype::method_replace(SimpleCallContext *ctx) if (!!searchCallback) { result.reserve(string.length() + 10*numStringMatches); ScopedCallData callData(scope, numCaptures + 2); - callData->thisObject = Value::undefinedValue(); + callData->thisObject = Primitive::undefinedValue(); int lastEnd = 0; for (int i = 0; i < numStringMatches; ++i) { for (int k = 0; k < numCaptures; ++k) { int idx = (i * numCaptures + k) * 2; uint start = matchOffsets[idx]; uint end = matchOffsets[idx + 1]; - Value entry = Value::undefinedValue(); + Value entry = Primitive::undefinedValue(); if (start != JSC::Yarr::offsetNoMatch && end != JSC::Yarr::offsetNoMatch) entry = Value::fromString(ctx, string.mid(start, end - start)); callData->args[k] = entry; @@ -525,7 +525,7 @@ ReturnedValue StringPrototype::method_replace(SimpleCallContext *ctx) uint matchStart = matchOffsets[i * numCaptures * 2]; Q_ASSERT(matchStart >= lastEnd); uint matchEnd = matchOffsets[i * numCaptures * 2 + 1]; - callData->args[numCaptures] = Value::fromUInt32(matchStart); + callData->args[numCaptures] = Primitive::fromUInt32(matchStart); callData->args[numCaptures + 1] = Value::fromString(ctx, string); replacement = searchCallback->call(callData); diff --git a/src/qml/jsruntime/qv4value_def_p.h b/src/qml/jsruntime/qv4value_def_p.h index ae176292da..188952bdd7 100644 --- a/src/qml/jsruntime/qv4value_def_p.h +++ b/src/qml/jsruntime/qv4value_def_p.h @@ -274,12 +274,6 @@ struct Q_QML_EXPORT Value } static Value emptyValue(); - static Value undefinedValue(); - static Value nullValue(); - static Value fromBoolean(Bool b); - static Value fromDouble(double d); - static Value fromInt32(int i); - static Value fromUInt32(uint i); static Value fromString(String *s); static Value fromObject(Object *o); static Value fromManaged(Managed *o); @@ -362,6 +356,19 @@ struct SafeValue : public Value Returned *as(); }; +struct Primitive : public Value +{ + static Primitive fromBoolean(bool b); + static Primitive fromInt32(int i); + static Value undefinedValue(); + static Primitive nullValue(); + static Primitive fromDouble(double d); + static Primitive fromUInt32(uint i); + + inline operator ValueRef(); + Value asValue() const { return *this; } +}; + template struct Safe : public SafeValue { diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 3134309d72..ba015958dc 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -97,9 +97,9 @@ inline void Value::mark() const { m->mark(); } -inline Value Value::undefinedValue() +inline Value Primitive::undefinedValue() { - Value v; + Primitive v; #if QT_POINTER_SIZE == 8 v.val = quint64(Undefined_Type) << Tag_Shift; #else @@ -109,9 +109,9 @@ inline Value Value::undefinedValue() return v; } -inline Value Value::nullValue() +inline Primitive Primitive::nullValue() { - Value v; + Primitive v; #if QT_POINTER_SIZE == 8 v.val = quint64(_Null_Type) << Tag_Shift; #else @@ -130,32 +130,32 @@ inline Value Value::emptyValue() } -inline Value Value::fromBoolean(Bool b) +inline Primitive Primitive::fromBoolean(bool b) { - Value v; + Primitive v; v.tag = _Boolean_Type; v.int_32 = (bool)b; return v; } -inline Value Value::fromDouble(double d) +inline Primitive Primitive::fromDouble(double d) { - Value v; + Primitive v; v.setDouble(d); return v; } -inline Value Value::fromInt32(int i) +inline Primitive Primitive::fromInt32(int i) { - Value v; + Primitive v; v.tag = _Integer_Type; v.int_32 = i; return v; } -inline Value Value::fromUInt32(uint i) +inline Primitive Primitive::fromUInt32(uint i) { - Value v; + Primitive v; if (i < INT_MAX) { v.tag = _Integer_Type; v.int_32 = (int)i; @@ -192,7 +192,7 @@ inline Value Value::fromObject(Object *o) inline Value Value::fromManaged(Managed *m) { if (!m) - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); Value v; #if QT_POINTER_SIZE == 8 v.m = m; @@ -392,7 +392,7 @@ public: ~PersistentValue(); ReturnedValue value() const { - return (d ? d->value : Value::undefinedValue()).asReturnedValue(); + return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue()); } ExecutionEngine *engine() { @@ -433,7 +433,7 @@ public: ~WeakValue(); ReturnedValue value() const { - return (d ? d->value : Value::undefinedValue()).asReturnedValue(); + return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue()); } ExecutionEngine *engine() { diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 0d4be2169b..ccde91c86a 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -238,7 +238,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, }; #undef MOTH_INSTR_ADDR *storeJumpTable = jumpTable; - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } #endif @@ -329,7 +329,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, QV4::CallData *callData = reinterpret_cast(stack + instr.callData); callData->tag = QV4::Value::Integer_Type; callData->argc = instr.argc; - callData->thisObject = QV4::Value::undefinedValue(); + callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, __qmljs_call_value(context, VALUEPTR(instr.dest), callData)); MOTH_END_INSTR(CallValue) @@ -358,7 +358,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, QV4::CallData *callData = reinterpret_cast(stack + instr.callData); callData->tag = QV4::Value::Integer_Type; callData->argc = instr.argc; - callData->thisObject = QV4::Value::undefinedValue(); + callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, __qmljs_call_activation_property(context, runtimeStrings[instr.name], callData)); MOTH_END_INSTR(CallActivationProperty) @@ -367,7 +367,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, MOTH_END_INSTR(CallBuiltinThrow) MOTH_BEGIN_INSTR(EnterTry) - VALUE(instr.exceptionVar) = QV4::Value::undefinedValue(); + VALUE(instr.exceptionVar) = QV4::Primitive::undefinedValue(); try { const uchar *tryCode = ((uchar *)&instr.tryOffset) + instr.tryOffset; run(context, tryCode, stack, stackSize); @@ -474,7 +474,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, QV4::CallData *callData = reinterpret_cast(stack + instr.callData); callData->tag = QV4::Value::Integer_Type; callData->argc = instr.argc; - callData->thisObject = QV4::Value::undefinedValue(); + callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, __qmljs_construct_value(context, VALUEPTR(instr.func), callData)); MOTH_END_INSTR(CreateValue) @@ -483,7 +483,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, QV4::CallData *callData = reinterpret_cast(stack + instr.callData); callData->tag = QV4::Value::Integer_Type; callData->argc = instr.argc; - callData->thisObject = QV4::Value::undefinedValue(); + callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, __qmljs_construct_property(context, VALUEPTR(instr.base), runtimeStrings[instr.name], callData)); MOTH_END_INSTR(CreateProperty) @@ -493,7 +493,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *&code, QV4::CallData *callData = reinterpret_cast(stack + instr.callData); callData->tag = QV4::Value::Integer_Type; callData->argc = instr.argc; - callData->thisObject = QV4::Value::undefinedValue(); + callData->thisObject = QV4::Primitive::undefinedValue(); STOREVALUE(instr.result, __qmljs_construct_activation_property(context, runtimeStrings[instr.name], callData)); MOTH_END_INSTR(CreateActivationProperty) diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 5db3de0988..76825edd94 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -202,7 +202,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) QV4::Value *args = (QV4::Value *)alloca(qMax(argCount, (int)QV4::Global::ReservedArgumentCount)*sizeof(QV4::Value)); #ifndef QT_NO_DEBUG for (int ii = 0; ii < qMax(argCount, (int)QV4::Global::ReservedArgumentCount); ++ii) - args[ii] = QV4::Value::undefinedValue(); + args[ii] = QV4::Primitive::undefinedValue(); #endif for (int ii = 0; ii < argCount; ++ii) { int type = argsTypes[ii + 1]; @@ -213,12 +213,12 @@ void QQmlBoundSignalExpression::evaluate(void **a) args[ii] = QV4::Value::fromReturnedValue(engine->fromVariant(*((QVariant *)a[ii + 1]))); } else if (type == QMetaType::Int) { //### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise - args[ii] = QV4::Value::fromInt32(*reinterpret_cast(a[ii + 1])); + args[ii] = QV4::Primitive::fromInt32(*reinterpret_cast(a[ii + 1])); } else if (type == qMetaTypeId()) { args[ii] = QV4::Value::fromReturnedValue(*reinterpret_cast(a[ii + 1])); } else if (ep->isQObject(type)) { if (!*reinterpret_cast(a[ii + 1])) - args[ii] = QV4::Value::nullValue(); + args[ii] = QV4::Primitive::nullValue(); else args[ii] = QV4::Value::fromReturnedValue(QV4::QObjectWrapper::wrap(ep->v4engine(), *reinterpret_cast(a[ii + 1]))); } else { diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index de1114a15e..6c7bdb7e90 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1208,7 +1208,7 @@ void QQmlComponent::createObject(QQmlV4Function *args) QObject *parent = 0; QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); - QV4::ScopedValue valuemap(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); if (args->length() >= 1) { QV4::Scoped qobjectWrapper(scope, (*args)[0]); @@ -1333,7 +1333,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) QV4::Scope scope(v4); QObject *parent = 0; - QV4::ScopedValue valuemap(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous; if (args->length() >= 1) { @@ -1485,9 +1485,9 @@ QmlIncubatorObject::QmlIncubatorObject(QV8Engine *engine, IncubationMode m) v8 = engine; vtbl = &static_vtbl; - valuemap = QV4::Value::undefinedValue(); - qmlGlobal = QV4::Value::undefinedValue(); - m_statusChanged = QV4::Value::undefinedValue(); + valuemap = QV4::Primitive::undefinedValue(); + qmlGlobal = QV4::Primitive::undefinedValue(); + m_statusChanged = QV4::Primitive::undefinedValue(); } void QmlIncubatorObject::setInitialState(QObject *o) @@ -1541,7 +1541,7 @@ void QmlIncubatorObject::statusChanged(Status s) try { QV4::ScopedCallData callData(scope, 1); callData->thisObject = QV4::Value::fromObject(this); - callData->args[0] = QV4::Value::fromUInt32(s); + callData->args[0] = QV4::Primitive::fromUInt32(s); f->call(callData); } catch (QV4::Exception &e) { e.accept(ctx); diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 46ff821fff..b7bb91f279 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -190,7 +190,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has if (index < context->importedScripts.count()) return context->importedScripts.at(index).value(); else - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } else if (r.type) { return QmlTypeWrapper::create(engine, scopeObject, r.type); } else if (r.importNamespace) { @@ -269,7 +269,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has expressionContext->unresolvedNames = true; - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef value) diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index e08e8eebb7..788d3e241c 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -138,7 +138,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, if (function.isUndefined()) { if (isUndefined) *isUndefined = true; - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine); @@ -162,7 +162,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); - QV4::ScopedValue result(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue()); QV4::ExecutionContext *ctx = v4->current; try { QV4::ScopedCallData callData(scope, argc); diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index 395a832c6e..5f4e92fa4e 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -107,7 +107,7 @@ ReturnedValue QmlListWrapper::get(Managed *m, const StringRef name, bool *hasPro if (name->isEqualTo(v4->id_length) && !w->object.isNull()) { quint32 count = w->property.count ? w->property.count(&w->property) : 0; - return Value::fromUInt32(count).asReturnedValue(); + return Primitive::fromUInt32(count).asReturnedValue(); } uint idx = name->asArrayIndex(); @@ -128,7 +128,7 @@ ReturnedValue QmlListWrapper::getIndexed(Managed *m, uint index, bool *hasProper if (index < count && w->property.at) return QV4::QObjectWrapper::wrap(e, w->property.at(&w->property, index)); - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void QmlListWrapper::put(Managed *m, const StringRef name, const ValueRef value) diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 400ef9f940..97ab56256e 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -548,7 +548,7 @@ QV4::ReturnedValue QQmlLocaleData::method_get_weekDays(QV4::SimpleCallContext *c int day = days.at(i); if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday) day = 0; - result->arrayData[i].value = QV4::Value::fromInt32(day); + result->arrayData[i].value = QV4::Primitive::fromInt32(day); } result->setArrayLengthUnchecked(days.size()); diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 2f4e782069..3b4e89861d 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -556,7 +556,7 @@ void QmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::C double n = binding->valueAsNumber(); if (double(int(n)) == n) { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Value::fromInt32(int(n))); + _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Primitive::fromInt32(int(n))); } else { int i = int(n); QVariant value(i); @@ -565,7 +565,7 @@ void QmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::C } } else { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Value::fromDouble(n)); + _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Primitive::fromDouble(n)); } else { QVariant value(n); argv[0] = &value; @@ -574,7 +574,7 @@ void QmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::C } } else if (binding->type == QV4::CompiledData::Binding::Type_Boolean) { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Value::fromBoolean(binding->valueAsBoolean())); + _vmeMetaObject->setVMEProperty(property->coreIndex, QV4::Primitive::fromBoolean(binding->valueAsBoolean())); } else { QVariant value(binding->valueAsBoolean()); argv[0] = &value; diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 13dad049c8..62f757f8c0 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -152,7 +152,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro bool ok; int value = e.keyToValue(enumName.constData(), &ok); if (ok) - return QV4::Value::fromInt32(value).asReturnedValue(); + return QV4::Primitive::fromInt32(value).asReturnedValue(); } } } @@ -174,7 +174,7 @@ ReturnedValue QmlTypeWrapper::get(Managed *m, const StringRef name, bool *hasPro bool ok = false; int value = type->enumValue(name, &ok); if (ok) - return QV4::Value::fromInt32(value).asReturnedValue(); + return QV4::Primitive::fromInt32(value).asReturnedValue(); // Fall through to base implementation diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index 31c3ba0fac..5eb0e6bc6e 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -276,7 +276,7 @@ ReturnedValue QmlValueTypeWrapper::get(Managed *m, const StringRef name, bool *h QmlValueTypeReference *reference = static_cast(r); if (!reference->object || !readReferenceValue(reference)) - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } else { Q_ASSERT(r->objectType == QmlValueTypeWrapper::Copy); diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 3b88e148c7..512b9b4674 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -421,9 +421,9 @@ QObject *QQmlVME::run(QList *errors, // Store a literal value in a var property. // We deliberately do not use string converters here QML_STORE_VAR(StoreVar, QV4::Value::fromReturnedValue(ep->v8engine()->fromVariant(PRIMITIVES.at(instr.value)))); - QML_STORE_VAR(StoreVarInteger, QV4::Value::fromInt32(instr.value)); - QML_STORE_VAR(StoreVarDouble, QV4::Value::fromDouble(instr.value)); - QML_STORE_VAR(StoreVarBool, QV4::Value::fromBoolean(instr.value)); + QML_STORE_VAR(StoreVarInteger, QV4::Primitive::fromInt32(instr.value)); + QML_STORE_VAR(StoreVarDouble, QV4::Primitive::fromDouble(instr.value)); + QML_STORE_VAR(StoreVarBool, QV4::Primitive::fromBoolean(instr.value)); // Store a literal value in a QJSValue property. QML_STORE_VALUE(StoreJSValueString, QJSValue, QJSValue(PRIMITIVES.at(instr.value))); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 9b557f882b..e8960eb328 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -78,7 +78,7 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *) QV4::Scope scope(v4); QV4::ScopedArrayObject a(scope, m_target->varProperties.value()); if (a) - a->putIndexed(m_index - m_target->firstVarPropertyIndex, QV4::ScopedValue(scope, QV4::Value::nullValue())); + a->putIndexed(m_index - m_target->firstVarPropertyIndex, QV4::ScopedValue(scope, QV4::Primitive::nullValue())); } } @@ -970,7 +970,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::method(int index) { if (!ctxt || !ctxt->isValid()) { qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context"); - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } if (!v8methods) @@ -1001,7 +1001,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id) QV4::ScopedObject o(scope, varProperties.value()); return o->getIndexed(id - firstVarPropertyIndex); } - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index c0ebe04563..39ba13a653 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -618,7 +618,7 @@ Value Node::create(QV8Engine *engine, NodeImpl *data) case NodeImpl::EntityReference: case NodeImpl::Notation: case NodeImpl::ProcessingInstruction: - return Value::undefinedValue(); + return Primitive::undefinedValue(); case NodeImpl::CDATA: instance->setPrototype(CDATA::prototype(v4).asObject()); break; @@ -916,7 +916,7 @@ ReturnedValue NamedNodeMap::get(Managed *m, const StringRef name, bool *hasPrope name->makeIdentifier(); if (name->isEqualTo(v4->id_length)) - return Value::fromInt32(r->list.count()).asReturnedValue(); + return Primitive::fromInt32(r->list.count()).asReturnedValue(); QV8Engine *engine = v4->v8Engine; @@ -971,7 +971,7 @@ ReturnedValue NodeList::get(Managed *m, const StringRef name, bool *hasProperty) name->makeIdentifier(); if (name->isEqualTo(v4->id_length)) - return Value::fromInt32(r->d->children.count()).asReturnedValue(); + return Primitive::fromInt32(r->d->children.count()).asReturnedValue(); return Object::get(m, name, hasProperty); } @@ -1440,7 +1440,7 @@ void QQmlXMLHttpRequest::finished() dispatchCallback(m_me); Scope scope(v4); - ScopedValue v(scope, Value::undefinedValue()); + ScopedValue v(scope, Primitive::undefinedValue()); setMe(v); } @@ -1612,11 +1612,11 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject Scope scope(engine); ScopedValue protectThis(scope, this); - defineReadonlyProperty(QStringLiteral("UNSENT"), Value::fromInt32(0)); - defineReadonlyProperty(QStringLiteral("OPENED"), Value::fromInt32(1)); - defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Value::fromInt32(2)); - defineReadonlyProperty(QStringLiteral("LOADING"), Value::fromInt32(3)); - defineReadonlyProperty(QStringLiteral("DONE"), Value::fromInt32(4)); + defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0)); + defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1)); + defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2)); + defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3)); + defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4)); if (!proto) setupProto(); ScopedString s(scope, engine->id_prototype); @@ -1647,7 +1647,7 @@ struct QQmlXMLHttpRequestCtor : public FunctionObject } static ReturnedValue call(Managed *, QV4::CallData *) { - return Value::undefinedValue().asReturnedValue(); + return Primitive::undefinedValue().asReturnedValue(); } void setupProto(); @@ -1694,11 +1694,11 @@ void QQmlXMLHttpRequestCtor::setupProto() proto->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0); // State values - proto->defineReadonlyProperty(QStringLiteral("UNSENT"), Value::fromInt32(0)); - proto->defineReadonlyProperty(QStringLiteral("OPENED"), Value::fromInt32(1)); - proto->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Value::fromInt32(2)); - proto->defineReadonlyProperty(QStringLiteral("LOADING"), Value::fromInt32(3)); - proto->defineReadonlyProperty(QStringLiteral("DONE"), Value::fromInt32(4)); + proto->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0)); + proto->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1)); + proto->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2)); + proto->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3)); + proto->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4)); } diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 691c8bd9df..9240834cf4 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -101,11 +101,11 @@ QV4::QtObject::QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine) for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) { QMetaEnum enumerator = qtMetaObject->enumerator(ii); for (int jj = 0; jj < enumerator.keyCount(); ++jj) { - put((str = v4->newString(enumerator.key(jj))), (v = QV4::Value::fromInt32(enumerator.value(jj)))); + put((str = v4->newString(enumerator.key(jj))), (v = QV4::Primitive::fromInt32(enumerator.value(jj)))); } } - put((str = v4->newString("Asynchronous")), (v = QV4::Value::fromInt32(0))); - put((str = v4->newString("Synchronous")), (v = QV4::Value::fromInt32(1))); + put((str = v4->newString("Asynchronous")), (v = QV4::Primitive::fromInt32(0))); + put((str = v4->newString("Synchronous")), (v = QV4::Primitive::fromInt32(1))); defineDefaultProperty(QStringLiteral("include"), QV4Include::method_include); defineDefaultProperty(QStringLiteral("isQtObject"), method_isQtObject); @@ -955,8 +955,8 @@ ReturnedValue QtObject::method_createQmlObject(SimpleCallContext *ctx) const QQmlError &error = errors.at(ii); errorstr += QLatin1String("\n ") + error.toString(); qmlerror = v4->newObject(); - qmlerror->put((s = v4->newString("lineNumber")), (v = QV4::Value::fromInt32(error.line()))); - qmlerror->put((s = v4->newString("columnNumber")), (v = QV4::Value::fromInt32(error.column()))); + qmlerror->put((s = v4->newString("lineNumber")), (v = QV4::Primitive::fromInt32(error.line()))); + qmlerror->put((s = v4->newString("columnNumber")), (v = QV4::Primitive::fromInt32(error.column()))); qmlerror->put((s = v4->newString("fileName")), (v = Value::fromString(v4->newString(error.url().toString())))); qmlerror->put((s = v4->newString("message")), (v = Value::fromString(v4->newString(error.description())))); qmlerrors->putIndexed(ii, qmlerror); diff --git a/src/qml/qml/v8/qv4domerrors.cpp b/src/qml/qml/v8/qv4domerrors.cpp index c0dbd54e64..60b76d087c 100644 --- a/src/qml/qml/v8/qv4domerrors.cpp +++ b/src/qml/qml/v8/qv4domerrors.cpp @@ -50,23 +50,23 @@ void qt_add_domexceptions(ExecutionEngine *e) { Scope scope(e); Scoped domexception(scope, e->newObject()); - domexception->defineReadonlyProperty(QStringLiteral("INDEX_SIZE_ERR"), Value::fromInt32(DOMEXCEPTION_INDEX_SIZE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("DOMSTRING_SIZE_ERR"), Value::fromInt32(DOMEXCEPTION_DOMSTRING_SIZE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("HIERARCHY_REQUEST_ERR"), Value::fromInt32(DOMEXCEPTION_HIERARCHY_REQUEST_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("WRONG_DOCUMENT_ERR"), Value::fromInt32(DOMEXCEPTION_WRONG_DOCUMENT_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_CHARACTER_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_CHARACTER_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NO_DATA_ALLOWED_ERR"), Value::fromInt32(DOMEXCEPTION_NO_DATA_ALLOWED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NO_MODIFICATION_ALLOWED_ERR"), Value::fromInt32(DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NOT_FOUND_ERR"), Value::fromInt32(DOMEXCEPTION_NOT_FOUND_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NOT_SUPPORTED_ERR"), Value::fromInt32(DOMEXCEPTION_NOT_SUPPORTED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INUSE_ATTRIBUTE_ERR"), Value::fromInt32(DOMEXCEPTION_INUSE_ATTRIBUTE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_STATE_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_STATE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Value::fromInt32(DOMEXCEPTION_SYNTAX_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_MODIFICATION_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_MODIFICATION_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NAMESPACE_ERR"), Value::fromInt32(DOMEXCEPTION_NAMESPACE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Value::fromInt32(DOMEXCEPTION_VALIDATION_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Value::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INDEX_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INDEX_SIZE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("DOMSTRING_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_DOMSTRING_SIZE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("HIERARCHY_REQUEST_ERR"), Primitive::fromInt32(DOMEXCEPTION_HIERARCHY_REQUEST_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("WRONG_DOCUMENT_ERR"), Primitive::fromInt32(DOMEXCEPTION_WRONG_DOCUMENT_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_CHARACTER_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_CHARACTER_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NO_DATA_ALLOWED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NO_DATA_ALLOWED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NO_MODIFICATION_ALLOWED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NOT_FOUND_ERR"), Primitive::fromInt32(DOMEXCEPTION_NOT_FOUND_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NOT_SUPPORTED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NOT_SUPPORTED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INUSE_ATTRIBUTE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INUSE_ATTRIBUTE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_STATE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_STATE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(DOMEXCEPTION_SYNTAX_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_MODIFICATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_MODIFICATION_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NAMESPACE_ERR"), Primitive::fromInt32(DOMEXCEPTION_NAMESPACE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_VALIDATION_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Primitive::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR)); e->globalObject->defineDefaultProperty(QStringLiteral("DOMException"), domexception.asValue()); } diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h index 3742e37114..686678c093 100644 --- a/src/qml/qml/v8/qv4domerrors_p.h +++ b/src/qml/qml/v8/qv4domerrors_p.h @@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE #define V4THROW_DOM(error, string) { \ QV4::ScopedValue v(scope, QV4::Value::fromString(ctx, QStringLiteral(string))); \ QV4::Scoped ex(scope, ctx->engine->newErrorObject(v)); \ - ex->put(QV4::ScopedString(scope, ctx->engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Value::fromInt32(error))); \ + ex->put(QV4::ScopedString(scope, ctx->engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(error))); \ ctx->throwError(ex); \ } diff --git a/src/qml/qml/v8/qv4sqlerrors.cpp b/src/qml/qml/v8/qv4sqlerrors.cpp index 9c97aacdbe..20fec3b26d 100644 --- a/src/qml/qml/v8/qv4sqlerrors.cpp +++ b/src/qml/qml/v8/qv4sqlerrors.cpp @@ -51,14 +51,14 @@ void qt_add_sqlexceptions(QV4::ExecutionEngine *engine) { Scope scope(engine); Scoped sqlexception(scope, engine->newObject()); - sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), Value::fromInt32(SQLEXCEPTION_UNKNOWN_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), Value::fromInt32(SQLEXCEPTION_DATABASE_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), Value::fromInt32(SQLEXCEPTION_VERSION_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("TOO_LARGE_ERR"), Value::fromInt32(SQLEXCEPTION_TOO_LARGE_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("QUOTA_ERR"), Value::fromInt32(SQLEXCEPTION_QUOTA_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Value::fromInt32(SQLEXCEPTION_SYNTAX_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Value::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Value::fromInt32(SQLEXCEPTION_TIMEOUT_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), Primitive::fromInt32(SQLEXCEPTION_UNKNOWN_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), Primitive::fromInt32(SQLEXCEPTION_DATABASE_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), Primitive::fromInt32(SQLEXCEPTION_VERSION_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("TOO_LARGE_ERR"), Primitive::fromInt32(SQLEXCEPTION_TOO_LARGE_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("QUOTA_ERR"), Primitive::fromInt32(SQLEXCEPTION_QUOTA_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(SQLEXCEPTION_SYNTAX_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Primitive::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Primitive::fromInt32(SQLEXCEPTION_TIMEOUT_ERR)); engine->globalObject->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception.asValue()); } diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 01f9ae8cc7..7d3686f76d 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -126,7 +126,7 @@ class QQmlV4Function { public: int length() const { return callData->argc; } - QV4::ReturnedValue operator[](int idx) { return (idx < callData->argc ? callData->args[idx] : QV4::Value::undefinedValue()).asReturnedValue(); } + QV4::ReturnedValue operator[](int idx) { return (idx < callData->argc ? callData->args[idx] : QV4::Primitive::undefinedValue()).asReturnedValue(); } QQmlContextData *context() { return ctx; } QV4::ReturnedValue qmlGlobal() { return callData->thisObject.asReturnedValue(); } void setReturnValue(QV4::ReturnedValue rv) { retVal = rv; } diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 130ed291c5..708dd8dbb2 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -78,7 +78,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *) { m->engine()->current->throwTypeError(); - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } static QV4::ReturnedValue call(QV4::Managed *that, QV4::CallData *callData) @@ -90,7 +90,7 @@ struct DelegateModelGroupFunction: QV4::FunctionObject if (!o) v4->current->throwTypeError(QStringLiteral("Not a valid VisualData object")); - QV4::Value v = callData->argc ? callData->args[0] : QV4::Value::undefinedValue(); + QV4::Value v = callData->argc ? callData->args[0] : QV4::Primitive::undefinedValue(); return f->code(o->item, f->flag, v); } }; @@ -3188,7 +3188,7 @@ public: if (index >= array->count()) { if (hasProperty) *hasProperty = false; - return QV4::Value::undefinedValue().asReturnedValue(); + return QV4::Primitive::undefinedValue().asReturnedValue(); } const QQmlChangeSet::Change &change = array->at(index); diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index ad23bc14d9..e16c8d819a 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -2115,7 +2115,7 @@ QQmlV4Handle QQmlListModel::get(int index) const { QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine()); QV4::Scope scope(v4); - QV4::ScopedValue result(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue()); if (index >= 0 && index < count()) { diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index c666372739..43732332c9 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -255,7 +255,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i QV4::ScopedValue v(scope); try { QV4::ScopedCallData callData(scope, 1); - callData->args[0] = QV4::Value::fromInt32(id); + callData->args[0] = QV4::Primitive::fromInt32(id); callData->thisObject = global(); v = f->call(callData); } catch (QV4::Exception &e) { @@ -288,7 +288,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::method_sendMessage(QV4::Simp int id = ctx->callData->argc > 1 ? ctx->callData->args[1].toInt32() : 0; - QByteArray data = QV4::Serialize::serialize(ctx->callData->argc > 2 ? ctx->callData->args[2] : QV4::Value::undefinedValue(), engine); + QByteArray data = QV4::Serialize::serialize(ctx->callData->argc > 2 ? ctx->callData->args[2] : QV4::Primitive::undefinedValue(), engine); QMutexLocker locker(&engine->p->m_lock); WorkerScript *script = engine->p->workers.value(id); @@ -683,7 +683,7 @@ void QQuickWorkerScript::sendMessage(QQmlV4Function *args) } QV4::Scope scope(args->v4engine()); - QV4::ScopedValue argument(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue argument(scope, QV4::Primitive::undefinedValue()); if (args->length() != 0) argument = (*args)[0]; diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 94fe95da4e..826feeb331 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -667,7 +667,7 @@ void QQuickCanvasItem::updatePolish() foreach (int key, animationCallbacks.keys()) { QV4::ScopedFunctionObject f(scope, animationCallbacks.value(key).value()); - callData->args[0] = QV4::Value::fromUInt32(QDateTime::currentDateTimeUtc().toTime_t()); + callData->args[0] = QV4::Primitive::fromUInt32(QDateTime::currentDateTimeUtc().toTime_t()); f->call(callData); } } diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 655632c662..263ee67398 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2596,7 +2596,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(QV4::SimpleC bool pointInPath = false; if (ctx->callData->argc == 2) pointInPath = r->context->isPointInPath(ctx->callData->args[0].toNumber(), ctx->callData->args[1].toNumber()); - return QV4::Value::fromBoolean(pointInPath).asReturnedValue(); + return QV4::Primitive::fromBoolean(pointInPath).asReturnedValue(); } QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawFocusRing(QV4::SimpleCallContext *ctx) @@ -2874,7 +2874,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(QV4::SimpleCal uint width = fm.width(ctx->callData->args[0].toQStringNoThrow()); QV4::Scoped tm(scope, ctx->engine->newObject()); tm->put(QV4::ScopedString(scope, ctx->engine->newIdentifier(QStringLiteral("width"))), - QV4::ScopedValue(scope, QV4::Value::fromDouble(width))); + QV4::ScopedValue(scope, QV4::Primitive::fromDouble(width))); return tm.asReturnedValue(); } return QV4::Encode::undefined(); diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index cd9e88e452..435f730fe1 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3900,15 +3900,15 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const QRectF r = mapRectFromItem(itemObj, QRectF(x, y, w, h)); - rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Value::fromDouble(r.x()))); - rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Value::fromDouble(r.y()))); - rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Value::fromDouble(r.width()))); - rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Value::fromDouble(r.height()))); + rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(r.x()))); + rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(r.y()))); + rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Primitive::fromDouble(r.width()))); + rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Primitive::fromDouble(r.height()))); } else { QPointF p = mapFromItem(itemObj, QPointF(x, y)); - rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Value::fromDouble(p.x()))); - rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Value::fromDouble(p.y()))); + rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(p.x()))); + rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(p.y()))); } } } @@ -3980,15 +3980,15 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const QRectF r = mapRectToItem(itemObj, QRectF(x, y, w, h)); - rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Value::fromDouble(r.x()))); - rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Value::fromDouble(r.y()))); - rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Value::fromDouble(r.width()))); - rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Value::fromDouble(r.height()))); + rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(r.x()))); + rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(r.y()))); + rv->put((s = v4->newString(QStringLiteral("width"))), (v = QV4::Primitive::fromDouble(r.width()))); + rv->put((s = v4->newString(QStringLiteral("height"))), (v = QV4::Primitive::fromDouble(r.height()))); } else { QPointF p = mapToItem(itemObj, QPointF(x, y)); - rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Value::fromDouble(p.x()))); - rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Value::fromDouble(p.y()))); + rv->put((s = v4->newString(QStringLiteral("x"))), (v = QV4::Primitive::fromDouble(p.x()))); + rv->put((s = v4->newString(QStringLiteral("y"))), (v = QV4::Primitive::fromDouble(p.y()))); } } } diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 1301225feb..a59c308354 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -940,7 +940,7 @@ QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV4Function *args) QV4::Value QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error) { QV4::Scope scope(args->v4engine()); - QV4::ScopedValue valuemap(scope, QV4::Value::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); if (args->length() >= 2) { QV4::ScopedValue v(scope, (*args)[1]); if (!v->isObject() || v->asArrayObject()) { diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 42d2719d00..4240ed6dcb 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2331,7 +2331,7 @@ static inline QV4::Value evaluate(QV8Engine *engine, const QV4::Value & o, try { QV4::Scoped function(scope, program.run()); if (!function) - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); QV4::ScopedCallData d(scope, 1); d->args[0] = o; d->thisObject = engine->global(); @@ -2340,7 +2340,7 @@ static inline QV4::Value evaluate(QV8Engine *engine, const QV4::Value & o, } catch (QV4::Exception &e) { e.accept(ctx); } - return QV4::Value::undefinedValue(); + return QV4::Primitive::undefinedValue(); } #define EVALUATE_ERROR(source) evaluate_error(engine, object, source) @@ -2389,14 +2389,14 @@ void tst_qqmlecmascript::callQtInvokables() // Excessive arguments o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); QCOMPARE(o->actuals().count(), 2); @@ -2405,19 +2405,19 @@ void tst_qqmlecmascript::callQtInvokables() // Test return types o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 0); QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", QV4::Value::fromInt32(6))); + QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", QV4::Primitive::fromInt32(6))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 1); QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", QV4::Value::fromDouble(19.75))); + QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", QV4::Primitive::fromDouble(19.75))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 2); QCOMPARE(o->actuals().count(), 0); @@ -2467,49 +2467,49 @@ void tst_qqmlecmascript::callQtInvokables() // Test arg types o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(94)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(94)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_int(object)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_int(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); QCOMPARE(o->actuals().count(), 2); @@ -2517,56 +2517,56 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant(9)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_real(object)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_real(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); QCOMPARE(o->actuals().count(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant("Hello world")); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QString(19)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QString(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); QCOMPARE(o->actuals().count(), 1); @@ -2575,7 +2575,7 @@ void tst_qqmlecmascript::callQtInvokables() o->reset(); { QString expected = "MyInvokableObject(0x" + QString::number((quintptr)o, 16) + ")"; - QVERIFY(EVALUATE_VALUE("object.method_QString(object)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QString(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); QCOMPARE(o->actuals().count(), 1); @@ -2583,126 +2583,126 @@ void tst_qqmlecmascript::callQtInvokables() } o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QString(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QString(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(0)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(0)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(object)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(99.3, -10.2))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(9, 12))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(0)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QObject(0)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)o)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); QCOMPARE(o->actuals().count(), 1); QVERIFY(qvariant_cast(o->actuals().at(0)).isNull()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); QCOMPARE(o->actuals().count(), 1); QVERIFY(qvariant_cast(o->actuals().at(0)).isUndefined()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); QCOMPARE(o->actuals().count(), 1); QVERIFY(qvariant_cast(o->actuals().at(0)).strictlyEquals(QJSValue(19))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); QCOMPARE(o->actuals().count(), 1); QVERIFY(qvariant_cast(o->actuals().at(0)).isArray()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); QCOMPARE(o->actuals().count(), 2); @@ -2710,7 +2710,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(qvariant_cast(o->actuals().at(1)).isNull()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); QCOMPARE(o->actuals().count(), 2); @@ -2718,7 +2718,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(qvariant_cast(o->actuals().at(1)).isUndefined()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); QCOMPARE(o->actuals().count(), 2); @@ -2726,7 +2726,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(qvariant_cast(o->actuals().at(1)).strictlyEquals(QJSValue(19))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); QCOMPARE(o->actuals().count(), 2); @@ -2740,14 +2740,14 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload(10)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload(10)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 16); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 17); QCOMPARE(o->actuals().count(), 2); @@ -2755,21 +2755,21 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant(11)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 18); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString("Hello"))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 19); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_default(10)", QV4::Value::fromInt32(19))); + QVERIFY(EVALUATE_VALUE("object.method_default(10)", QV4::Primitive::fromInt32(19))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); QCOMPARE(o->actuals().count(), 2); @@ -2777,7 +2777,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant(19)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", QV4::Value::fromInt32(13))); + QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", QV4::Primitive::fromInt32(13))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); QCOMPARE(o->actuals().count(), 2); @@ -2785,14 +2785,14 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant(13)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -3); QCOMPARE(o->actuals().count(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); QCOMPARE(o->actuals().count(), 2); @@ -2800,7 +2800,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); QCOMPARE(o->actuals().count(), 2); @@ -2808,91 +2808,91 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(1), QVariant(QString("World"))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonObject({foo:123})", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonObject({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 22); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonArray([123])", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonArray([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 23); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(123)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(123)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(123)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(42.35)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(42.35)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(42.35)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue('ciao')", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue('ciao')", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(QStringLiteral("ciao"))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(true)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(true)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(true)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(false)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(false)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(false)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload({foo:123})", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 25); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload([123])", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 26); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload(null)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_overload(undefined)", QV4::Value::undefinedValue())); + QVERIFY(EVALUATE_VALUE("object.method_overload(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); QCOMPARE(o->actuals().count(), 1); diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp index 8e9a880ccd..38329b8289 100644 --- a/tools/v4/main.cpp +++ b/tools/v4/main.cpp @@ -85,7 +85,7 @@ struct Print: FunctionObject std::cout << qPrintable(s); } std::cout << std::endl; - return Value::undefinedValue().asReturnedValue(); + return Encode::undefined(); } static const ManagedVTable static_vtbl; @@ -103,7 +103,7 @@ struct GC: public FunctionObject static ReturnedValue call(Managed *m, CallData *) { m->engine()->memoryManager->runGC(); - return Value::undefinedValue().asReturnedValue(); + return Encode::undefined(); } static const ManagedVTable static_vtbl; -- cgit v1.2.3