From 2fadffdc4630eca35d775d973a368feae2630bd9 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Wed, 31 Dec 2014 10:42:15 -0800 Subject: Use QV4::ScopedFunctionObject typedef instead of actual type Change-Id: I6b4effaa5bef992b4ae9402eea7fe655bc7b18f0 Reviewed-by: Simon Hausmann --- src/imports/localstorage/plugin.cpp | 2 +- src/qml/jsruntime/qv4arraybuffer.cpp | 2 +- src/qml/jsruntime/qv4arrayobject.cpp | 14 +++++++------- src/qml/jsruntime/qv4functionobject.cpp | 2 +- src/qml/jsruntime/qv4jsonobject.cpp | 2 +- src/qml/jsruntime/qv4object.cpp | 4 ++-- src/qml/jsruntime/qv4objectproto.cpp | 6 +++--- src/qml/jsruntime/qv4runtime.cpp | 4 ++-- src/qml/jsruntime/qv4stringobject.cpp | 4 ++-- src/qml/jsruntime/qv4typedarray.cpp | 2 +- src/qml/qml/qqmlboundsignal.cpp | 2 +- src/qml/qml/qqmlcomponent.cpp | 4 ++-- src/qml/qml/qqmlvmemetaobject.cpp | 2 +- src/qml/qml/qqmlxmlhttprequest.cpp | 2 +- src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 2 +- src/qml/qml/v8/qv8engine.cpp | 2 +- src/qml/types/qquickworkerscript.cpp | 2 +- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 6 +++--- 18 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 95e4be0c98..e281179a52 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -389,7 +389,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(CallContext *ctx) QSqlDatabase db = r->d()->database; QString from_version = ctx->d()->callData->args[0].toQString(); QString to_version = ctx->d()->callData->args[1].toQString(); - Scoped callback(scope, ctx->argument(2)); + ScopedFunctionObject callback(scope, ctx->argument(2)); if (from_version != r->d()->version) V4THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->d()->version)); diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index 9fc3114751..f54161ea18 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -147,7 +147,7 @@ ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx) double first = (start < 0) ? qMax(a->d()->data->size + start, 0.) : qMin(start, (double)a->d()->data->size); double final = (end < 0) ? qMax(a->d()->data->size + end, 0.) : qMin(end, (double)a->d()->data->size); - Scoped constructor(scope, a->get(scope.engine->id_constructor)); + ScopedFunctionObject constructor(scope, a->get(scope.engine->id_constructor)); if (!constructor) return scope.engine->throwTypeError(); diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index f6e676de2c..d388875e3b 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -690,7 +690,7 @@ ReturnedValue ArrayPrototype::method_every(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -724,7 +724,7 @@ ReturnedValue ArrayPrototype::method_some(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -758,7 +758,7 @@ ReturnedValue ArrayPrototype::method_forEach(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -789,7 +789,7 @@ ReturnedValue ArrayPrototype::method_map(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -826,7 +826,7 @@ ReturnedValue ArrayPrototype::method_filter(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -867,7 +867,7 @@ ReturnedValue ArrayPrototype::method_reduce(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); @@ -917,7 +917,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(CallContext *ctx) uint len = instance->getLength(); - Scoped callback(scope, ctx->argument(0)); + ScopedFunctionObject callback(scope, ctx->argument(0)); if (!callback) return ctx->engine()->throwTypeError(); diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 4b6e4358df..4879b7db24 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -361,7 +361,7 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx) ReturnedValue FunctionPrototype::method_bind(CallContext *ctx) { Scope scope(ctx); - Scoped target(scope, ctx->d()->callData->thisObject); + ScopedFunctionObject target(scope, ctx->d()->callData->thisObject); if (!target) return ctx->engine()->throwTypeError(); diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index a34faeed1a..0bd4cec336 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -707,7 +707,7 @@ QString Stringify::Str(const QString &key, ValueRef v) ScopedObject o(scope, value); if (o) { ScopedString s(scope, ctx->d()->engine->newString(QStringLiteral("toJSON"))); - Scoped toJSON(scope, o->get(s)); + ScopedFunctionObject toJSON(scope, o->get(s)); if (!!toJSON) { ScopedCallData callData(scope, 1); callData->thisObject = value; diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index 9f53a9b2d5..cc7171de72 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -137,7 +137,7 @@ void Object::defineDefaultProperty(const QString &name, ReturnedValue (*code)(Ca Scope scope(e); ScopedString s(scope, e->newIdentifier(name)); ScopedContext global(scope, e->rootContext()); - Scoped function(scope, BuiltinFunction::create(global, s, code)); + ScopedFunctionObject function(scope, BuiltinFunction::create(global, s, code)); function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount)); defineDefaultProperty(s, function); } @@ -147,7 +147,7 @@ void Object::defineDefaultProperty(String *name, ReturnedValue (*code)(CallConte ExecutionEngine *e = engine(); Scope scope(e); ScopedContext global(scope, e->rootContext()); - Scoped function(scope, BuiltinFunction::create(global, name, code)); + ScopedFunctionObject function(scope, BuiltinFunction::create(global, name, code)); function->defineReadonlyProperty(e->id_length, Primitive::fromInt32(argumentCount)); defineDefaultProperty(name, function); } diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 3a6ddee55b..4e90f652e4 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -405,7 +405,7 @@ ReturnedValue ObjectPrototype::method_toLocaleString(CallContext *ctx) ScopedObject o(scope, ctx->d()->callData->thisObject.toObject(scope.engine)); if (!o) return Encode::undefined(); - Scoped f(scope, o->get(ctx->d()->engine->id_toString)); + ScopedFunctionObject f(scope, o->get(ctx->d()->engine->id_toString)); if (!f) return ctx->engine()->throwTypeError(); ScopedCallData callData(scope); @@ -477,7 +477,7 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx) return ctx->engine()->throwTypeError(); Scope scope(ctx); - Scoped f(scope, ctx->argument(1)); + ScopedFunctionObject f(scope, ctx->argument(1)); if (!f) return ctx->engine()->throwTypeError(); @@ -505,7 +505,7 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx) return ctx->engine()->throwTypeError(); Scope scope(ctx); - Scoped f(scope, ctx->argument(1)); + ScopedFunctionObject f(scope, ctx->argument(1)); if (!f) return ctx->engine()->throwTypeError(); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 9b8912fecb..079b147840 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -905,7 +905,7 @@ ReturnedValue Runtime::callGlobalLookup(ExecutionEngine *engine, uint index, Cal Q_ASSERT(callData->thisObject.isUndefined()); Lookup *l = engine->currentContext()->lookups + index; - Scoped o(scope, l->globalGetter(l, engine)); + ScopedFunctionObject o(scope, l->globalGetter(l, engine)); if (!o) return engine->throwTypeError(); @@ -966,7 +966,7 @@ ReturnedValue Runtime::callProperty(ExecutionEngine *engine, int nameIndex, Call callData->thisObject = baseObject.asReturnedValue(); } - Scoped o(scope, baseObject->get(name)); + ScopedFunctionObject o(scope, baseObject->get(name)); if (!o) { QString error = QStringLiteral("Property '%1' of object %2 is not a function").arg(name->toQString(), callData->thisObject.toQStringNoThrow()); return engine->throwTypeError(error); diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 4dd4d5a8d4..df6c8c44a5 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -387,7 +387,7 @@ ReturnedValue StringPrototype::method_match(CallContext *context) // ### use the standard builtin function, not the one that might be redefined in the proto ScopedString execString(scope, scope.engine->newString(QStringLiteral("exec"))); - Scoped exec(scope, scope.engine->regExpPrototype.asObject()->get(execString)); + ScopedFunctionObject exec(scope, scope.engine->regExpPrototype.asObject()->get(execString)); ScopedCallData callData(scope, 1); callData->thisObject = rx; @@ -536,7 +536,7 @@ ReturnedValue StringPrototype::method_replace(CallContext *ctx) QString result; ScopedValue replacement(scope); ScopedValue replaceValue(scope, ctx->argument(1)); - Scoped searchCallback(scope, replaceValue); + ScopedFunctionObject searchCallback(scope, replaceValue); if (!!searchCallback) { result.reserve(string.length() + 10*numStringMatches); ScopedCallData callData(scope, numCaptures + 2); diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 088c5e1bf8..74adc2e38b 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -560,7 +560,7 @@ ReturnedValue TypedArrayPrototype::method_subarray(CallContext *ctx) int newLen = end - begin; - Scoped constructor(scope, a->get(scope.engine->id_constructor)); + ScopedFunctionObject constructor(scope, a->get(scope.engine->id_constructor)); if (!constructor) return scope.engine->throwTypeError(); diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 6720491f1f..aa1c1f6a33 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -181,7 +181,7 @@ QV4::Function *QQmlBoundSignalExpression::function() const if (expressionFunctionValid()) { Q_ASSERT (context() && engine()); QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine()); - QV4::Scoped v(scope, m_v8function.value()); + QV4::ScopedFunctionObject v(scope, m_v8function.value()); return v ? v->function() : 0; } return 0; diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 7f794e6863..255528c260 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1396,7 +1396,7 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu if (!valuemap->isUndefined()) { QV4::ScopedObject qmlGlobalObj(scope, qmlGlobal); - QV4::Scoped f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine), + QV4::ScopedFunctionObject f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine), QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobalObj)); QV4::ScopedCallData callData(scope, 2); callData->thisObject = v4engine->globalObject(); @@ -1498,7 +1498,7 @@ void QV4::QmlIncubatorObject::setInitialState(QObject *o) QV4::ExecutionEngine *v4 = QV8Engine::getV4(d()->v8); QV4::Scope scope(v4); - QV4::Scoped f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject())); + QV4::ScopedFunctionObject f(scope, QV4::Script::evaluate(v4, QString::fromLatin1(INITIALPROPERTIES_SOURCE), d()->qmlGlobal.asObject())); QV4::ScopedCallData callData(scope, 2); callData->thisObject = v4->globalObject(); callData->args[0] = QV4::QObjectWrapper::wrap(v4, o); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 7838d6ce5a..1f21b21aad 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -926,7 +926,7 @@ int QQmlVMEMetaObject::metaCall(QMetaObject::Call c, int _id, void **a) QV4::Scope scope(ep->v4engine()); - QV4::Scoped function(scope, method(id)); + QV4::ScopedFunctionObject function(scope, method(id)); if (!function) { // The function was not compiled. There are some exceptional cases which the // expression rewriter does not rewrite properly (e.g., \r-terminated lines diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 0117432e31..c8b771e9f9 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1570,7 +1570,7 @@ void QQmlXMLHttpRequest::dispatchCallbackImpl(const ValueRef me) } s = v4->newString(QStringLiteral("onreadystatechange")); - Scoped callback(scope, thisObj->get(s)); + ScopedFunctionObject callback(scope, thisObj->get(s)); if (!callback) { // not an error, but no onreadystatechange function to call. return; diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index f114616405..06c4e6f592 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -1165,7 +1165,7 @@ void QQmlBindingFunction::initBindingLocation() ReturnedValue QQmlBindingFunction::call(Managed *that, CallData *callData) { Scope scope(that->engine()); - Scoped function(scope, static_cast(that)->d()->originalFunction); + ScopedFunctionObject function(scope, static_cast(that)->d()->originalFunction); return function->call(callData); } diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 3c6fa32f39..81e4c71149 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -518,7 +518,7 @@ void QV8Engine::initializeGlobal() " }"\ "})" - QV4::Scoped result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0)); + QV4::ScopedFunctionObject result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0)); Q_ASSERT(!!result); m_freezeObject = result; #undef FREEZE_SOURCE diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 931da96c7d..7289a476c6 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -225,7 +225,7 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() onmessage = QV4::Script(globalContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run(); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro Q_ASSERT(!scope.engine->hasException); QV4::Script createsendscript(globalContext, QString::fromUtf8(SEND_MESSAGE_CREATE_SCRIPT)); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro - QV4::Scoped createsendconstructor(scope, createsendscript.run()); + QV4::ScopedFunctionObject createsendconstructor(scope, createsendscript.run()); Q_ASSERT(!scope.engine->hasException); QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage"))); QV4::ScopedValue function(scope, QV4::BuiltinFunction::create(globalContext, name, diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 8627c3d1ec..0a0ba3ea4c 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2306,7 +2306,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::ValueRef o, cons QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); program.inheritContext = true; - QV4::Scoped function(scope, program.run()); + QV4::ScopedFunctionObject function(scope, program.run()); if (scope.engine->hasException) { scope.engine->catchException(); return true; @@ -2332,7 +2332,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o, QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); program.inheritContext = true; - QV4::Scoped function(scope, program.run()); + QV4::ScopedFunctionObject function(scope, program.run()); if (scope.engine->hasException) { scope.engine->catchException(); return false; @@ -2363,7 +2363,7 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef QV4::Script program(QV4::ScopedContext(scope, scope.engine->rootContext()), functionSource); program.inheritContext = true; - QV4::Scoped function(scope, program.run()); + QV4::ScopedFunctionObject function(scope, program.run()); if (scope.engine->hasException) { scope.engine->catchException(); return QV4::Encode::undefined(); -- cgit v1.2.3