aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4regexpobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-26 13:05:25 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-28 13:33:58 +0200
commit62d1b5a08aa2c21c95a2a77afbe34c38ed37a2aa (patch)
treed9e542dfb9d7fa5d8e1c71633f6cd18cf234b5e6 /src/qml/jsruntime/qv4regexpobject.cpp
parent112531bc23494ba3c5cf2e0a51b2d654be28dbfd (diff)
Fix API for Object::define*Property
use ValueRef instead of const Value &. Change-Id: I3fd0ca829870db27f036825d713c53dc0600be07 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4regexpobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 126188fcb7..bab4a32073 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -241,8 +241,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] : Primitive::undefinedValue());
- ScopedValue f(scope, callData->argc > 1 ? callData->args[1] : Primitive::undefinedValue());
+ ScopedValue r(scope, callData->argument(0));
+ ScopedValue f(scope, callData->argument(1));
if (RegExpObject *re = r->as<RegExpObject>()) {
if (!f->isUndefined())
ctx->throwTypeError();
@@ -290,11 +290,14 @@ ReturnedValue RegExpCtor::call(Managed *that, CallData *callData)
return construct(that, callData);
}
-void RegExpPrototype::init(ExecutionEngine *engine, const Value &ctor)
+void RegExpPrototype::init(ExecutionEngine *engine, ObjectRef ctor)
{
- ctor.objectValue()->defineReadonlyProperty(engine->id_prototype, Value::fromObject(this));
- ctor.objectValue()->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(2));
- defineDefaultProperty(QStringLiteral("constructor"), ctor);
+ Scope scope(engine);
+ ScopedObject o(scope);
+
+ ctor->defineReadonlyProperty(engine->id_prototype, (o = this));
+ ctor->defineReadonlyProperty(engine->id_length, Primitive::fromInt32(2));
+ defineDefaultProperty(QStringLiteral("constructor"), (o = ctor));
defineDefaultProperty(QStringLiteral("exec"), method_exec, 1);
defineDefaultProperty(QStringLiteral("test"), method_test, 1);
defineDefaultProperty(engine->id_toString, method_toString, 0);