Use QV4::ScopedString typedef instead of actual type
authorOleg Shparber <trollixx@gmail.com>
Wed, 31 Dec 2014 18:34:52 +0000 (10:34 -0800)
committerOleg Shparber <trollixx@gmail.com>
Fri, 2 Jan 2015 20:29:09 +0000 (21:29 +0100)
Change-Id: I64ecbf6cea463387a70e909ecc5f9165d22a7b0f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/imports/localstorage/plugin.cpp
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4globalobject.cpp
src/qml/jsruntime/qv4lookup.cpp
src/qml/jsruntime/qv4object.cpp
src/qml/jsruntime/qv4objectproto.cpp
src/qml/qml/qqmlcontextwrapper.cpp
src/qml/qml/qqmlvaluetypewrapper.cpp
src/qml/types/qqmllistmodel.cpp
src/quick/items/context2d/qquickcontext2d.cpp
tests/auto/qml/qv4debugger/tst_qv4debugger.cpp

index 8ee2742..95e4be0 100644 (file)
@@ -57,7 +57,7 @@
 QT_BEGIN_NAMESPACE
 
 #define V4THROW_SQL(error, desc) { \
-    QV4::Scoped<String> v(scope, scope.engine->newString(desc)); \
+    QV4::ScopedString v(scope, scope.engine->newString(desc)); \
     QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
     ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
     ctx->engine()->throwError(ex); \
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
 }
 
 #define V4THROW_SQL2(error, desc) { \
-    QV4::Scoped<String> v(scope, scope.engine->newString(desc)); \
+    QV4::ScopedString v(scope, scope.engine->newString(desc)); \
     QV4::Scoped<Object> ex(scope, scope.engine->newErrorObject(v)); \
     ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Primitive::fromInt32(error))); \
     args->setReturnValue(ctx->engine()->throwError(ex)); \
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
 }
 
 #define V4THROW_REFERENCE(string) { \
-    QV4::Scoped<String> v(scope, scope.engine->newString(string)); \
+    QV4::ScopedString v(scope, scope.engine->newString(string)); \
     ctx->engine()->throwReferenceError(v); \
     return Encode::undefined(); \
 }
index fc004f5..e1e57f9 100644 (file)
@@ -456,7 +456,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
     globalObject()->defineDefaultProperty(QStringLiteral("escape"), GlobalFunctions::method_escape, 1);
     globalObject()->defineDefaultProperty(QStringLiteral("unescape"), GlobalFunctions::method_unescape, 1);
 
-    Scoped<String> name(scope, newString(QStringLiteral("thrower")));
+    ScopedString name(scope, newString(QStringLiteral("thrower")));
     thrower = BuiltinFunction::create(global, name, ::throwTypeError);
 }
 
@@ -1085,7 +1085,7 @@ ReturnedValue ExecutionEngine::throwTypeError(const QString &message)
 ReturnedValue ExecutionEngine::throwReferenceError(const ValueRef value)
 {
     Scope scope(this);
-    Scoped<String> s(scope, value->toString(this));
+    ScopedString s(scope, value->toString(this));
     QString msg = s->toQString() + QStringLiteral(" is not defined");
     Scoped<Object> error(scope, newReferenceErrorObject(msg));
     return throwError(error);
index a6f1b43..c9d61f7 100644 (file)
@@ -516,7 +516,7 @@ ReturnedValue GlobalFunctions::method_parseFloat(CallContext *ctx)
     Scope scope(ctx);
 
     // [15.1.2.3] step by step:
-    Scoped<String> inputString(scope, ctx->argument(0), Scoped<String>::Convert);
+    ScopedString inputString(scope, ctx->argument(0), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
 
index abb769b..8a9a6c3 100644 (file)
@@ -602,7 +602,7 @@ ReturnedValue Lookup::globalGetterGeneric(Lookup *l, ExecutionEngine *engine)
         }
     }
     Scope scope(engine);
-    Scoped<String> n(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
+    ScopedString n(scope, engine->currentContext()->compilationUnit->runtimeStrings[l->nameIndex]);
     return engine->throwReferenceError(n);
 }
 
index eb44d4a..9f53a9b 100644 (file)
@@ -156,7 +156,7 @@ void Object::defineAccessorProperty(const QString &name, ReturnedValue (*getter)
 {
     ExecutionEngine *e = engine();
     Scope scope(e);
-    Scoped<String> s(scope, e->newIdentifier(name));
+    ScopedString s(scope, e->newIdentifier(name));
     defineAccessorProperty(s, getter, setter);
 }
 
index 31e65d4..3a6ddee 100644 (file)
@@ -137,7 +137,7 @@ ReturnedValue ObjectPrototype::method_getOwnPropertyDescriptor(CallContext *ctx)
         Scoped<ArgumentsObject>(scope, O)->fullyCreate();
 
     ScopedValue v(scope, ctx->argument(1));
-    Scoped<String> name(scope, v->toString(scope.engine));
+    ScopedString name(scope, v->toString(scope.engine));
     if (scope.hasException())
         return Encode::undefined();
     PropertyAttributes attrs;
@@ -181,7 +181,7 @@ ReturnedValue ObjectPrototype::method_defineProperty(CallContext *ctx)
     if (!O)
         return ctx->engine()->throwTypeError();
 
-    Scoped<String> name(scope, ctx->argument(1), Scoped<String>::Convert);
+    ScopedString name(scope, ctx->argument(1), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
 
@@ -425,7 +425,7 @@ ReturnedValue ObjectPrototype::method_valueOf(CallContext *ctx)
 ReturnedValue ObjectPrototype::method_hasOwnProperty(CallContext *ctx)
 {
     Scope scope(ctx);
-    Scoped<String> P(scope, ctx->argument(0), Scoped<String>::Convert);
+    ScopedString P(scope, ctx->argument(0), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
     Scoped<Object> O(scope, ctx->d()->callData->thisObject, Scoped<Object>::Convert);
@@ -459,7 +459,7 @@ ReturnedValue ObjectPrototype::method_isPrototypeOf(CallContext *ctx)
 ReturnedValue ObjectPrototype::method_propertyIsEnumerable(CallContext *ctx)
 {
     Scope scope(ctx);
-    Scoped<String> p(scope, ctx->argument(0), Scoped<String>::Convert);
+    ScopedString p(scope, ctx->argument(0), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
 
@@ -481,7 +481,7 @@ ReturnedValue ObjectPrototype::method_defineGetter(CallContext *ctx)
     if (!f)
         return ctx->engine()->throwTypeError();
 
-    Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert);
+    ScopedString prop(scope, ctx->argument(0), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
 
@@ -509,7 +509,7 @@ ReturnedValue ObjectPrototype::method_defineSetter(CallContext *ctx)
     if (!f)
         return ctx->engine()->throwTypeError();
 
-    Scoped<String> prop(scope, ctx->argument(0), Scoped<String>::Convert);
+    ScopedString prop(scope, ctx->argument(0), ScopedString::Convert);
     if (scope.engine->hasException)
         return Encode::undefined();
 
index 0b63849..712cba7 100644 (file)
@@ -288,7 +288,7 @@ void QmlContextWrapper::put(Managed *m, String *name, const ValueRef value)
         if (wrapper && wrapper->d()->readOnly) {
             QString error = QLatin1String("Invalid write to global property \"") + name->toQString() +
                             QLatin1Char('"');
-            Scoped<String> e(scope, v4->currentContext()->engine->newString(error));
+            ScopedString e(scope, v4->currentContext()->engine->newString(error));
             v4->throwError(e);
             return;
         }
index a7c4d6c..222ab0a 100644 (file)
@@ -363,7 +363,7 @@ void QQmlValueTypeWrapper::put(Managed *m, String *name, const ValueRef value)
         if (!f->bindingKeyFlag()) {
             // assigning a JS function to a non-var-property is not allowed.
             QString error = QStringLiteral("Cannot assign JavaScript function to value-type property");
-            Scoped<String> e(scope, v4->newString(error));
+            ScopedString e(scope, v4->newString(error));
             v4->throwError(e);
             return;
         }
index bac6aed..cf9ee74 100644 (file)
@@ -410,7 +410,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
     QV4::ScopedObject o(scope);
 
     QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
-    QV4::Scoped<QV4::String> propertyName(scope);
+    QV4::ScopedString propertyName(scope);
     QV4::ScopedValue propertyValue(scope);
     QV4::ScopedString s(scope);
     QV4::ScopedArrayObject a(scope);
@@ -486,7 +486,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
     QV4::Scope scope(v4);
 
     QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
-    QV4::Scoped<QV4::String> propertyName(scope);
+    QV4::ScopedString propertyName(scope);
     QV4::ScopedValue propertyValue(scope);
     QV4::ScopedObject o(scope);
     QV4::ScopedArrayObject a(scope);
index a028055..205cf74 100644 (file)
@@ -2627,7 +2627,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(QV4::CallContext *ctx)
     QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
     CHECK_CONTEXT_SETTER(r)
 
-    QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+    QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
     if (scope.engine->hasException)
         return QV4::Encode::undefined();
     QFont font = qt_font_from_string(s->toQString(), r->d()->context->state.font);
@@ -2679,7 +2679,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(QV4::CallContext *ctx
     QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
     CHECK_CONTEXT_SETTER(r)
 
-    QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+    QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
     if (scope.engine->hasException)
         return QV4::Encode::undefined();
     QString textAlign = s->toQString();
@@ -2746,7 +2746,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(QV4::CallContext *
     QV4::Scope scope(ctx);
     QV4::Scoped<QQuickJSContext2D> r(scope, ctx->d()->callData->thisObject);
     CHECK_CONTEXT_SETTER(r)
-    QV4::Scoped<QV4::String> s(scope, ctx->argument(0), QV4::Scoped<QV4::String>::Convert);
+    QV4::ScopedString s(scope, ctx->argument(0), QV4::ScopedString::Convert);
     if (scope.engine->hasException)
         return QV4::Encode::undefined();
     QString textBaseline = s->toQString();
index 38024da..70e6739 100644 (file)
@@ -82,7 +82,7 @@ public:
         QV4::ExecutionEngine *v4 = v4Engine();
         QV4::Scope scope(v4);
 
-        QV4::Scoped<QV4::String> name(scope, v4->newString(functionName));
+        QV4::ScopedString name(scope, v4->newString(functionName));
         QV4::ScopedContext ctx(scope, v4->rootContext());
         QV4::ScopedValue function(scope, BuiltinFunction::create(ctx, name, injectedFunction));
         v4->globalObject()->put(name, function);