diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-08-03 20:26:28 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-08-04 07:08:19 +0000 |
commit | c0f961cd6b82a523e277f6d8778a20508b15697d (patch) | |
tree | 7e4986686630404123a9f40eeb4881a089072d12 /src/qml/jsruntime/qv4dateobject.cpp | |
parent | b46b2e28b39443f6250c0d751a593b35af1c8c1e (diff) |
Change function signatures for call/construct back
Change those back again to return a value. This will be required
to avoid creation of Scope objects between JS function calls.
Change-Id: I05cb5cf8fd0c13dcefa60d213ccd5983fab57ea3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4dateobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index c56d007028..0e681f9946 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -677,7 +677,7 @@ void Heap::DateCtor::init(QV4::ExecutionContext *scope) Heap::FunctionObject::init(scope, QStringLiteral("Date")); } -void DateCtor::construct(const Managed *, Scope &scope, CallData *callData) +ReturnedValue DateCtor::construct(const Managed *that, CallData *callData) { double t = 0; @@ -685,6 +685,7 @@ void DateCtor::construct(const Managed *, Scope &scope, CallData *callData) t = currentTime(); else if (callData->argc == 1) { + Scope scope(that->engine()); ScopedValue arg(scope, callData->args[0]); if (DateObject *d = arg->as<DateObject>()) { t = d->date(); @@ -712,13 +713,13 @@ void DateCtor::construct(const Managed *, Scope &scope, CallData *callData) t = TimeClip(UTC(t)); } - scope.result = Encode(scope.engine->newDateObject(Primitive::fromDouble(t))); + return Encode(that->engine()->newDateObject(Primitive::fromDouble(t))); } -void DateCtor::call(const Managed *m, Scope &scope, CallData *) +ReturnedValue DateCtor::call(const Managed *m, CallData *) { double t = currentTime(); - scope.result = static_cast<const DateCtor *>(m)->engine()->newString(ToString(t)); + return m->engine()->newString(ToString(t))->asReturnedValue(); } void DatePrototype::init(ExecutionEngine *engine, Object *ctor) @@ -1378,7 +1379,7 @@ void DatePrototype::method_toJSON(const BuiltinFunction *, Scope &scope, CallDat ScopedCallData cData(scope); cData->thisObject = callData->thisObject; - toIso->call(scope, cData); + scope.result = toIso->call(cData); } void DatePrototype::timezoneUpdated() |