aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4dataview.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-08-03 20:26:28 +0200
committerLars Knoll <lars.knoll@qt.io>2017-08-04 07:08:19 +0000
commitc0f961cd6b82a523e277f6d8778a20508b15697d (patch)
tree7e4986686630404123a9f40eeb4881a089072d12 /src/qml/jsruntime/qv4dataview.cpp
parentb46b2e28b39443f6250c0d751a593b35af1c8c1e (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/qv4dataview.cpp')
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index f1405e08ee..b4e21b7ce5 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -54,34 +54,31 @@ void Heap::DataViewCtor::init(QV4::ExecutionContext *scope)
Heap::FunctionObject::init(scope, QStringLiteral("DataView"));
}
-void DataViewCtor::construct(const Managed *, Scope &scope, CallData *callData)
+ReturnedValue DataViewCtor::construct(const Managed *m, CallData *callData)
{
+ Scope scope(m->engine());
Scoped<ArrayBuffer> buffer(scope, callData->argument(0));
- if (!buffer) {
- scope.result = scope.engine->throwTypeError();
- return;
- }
+ if (!buffer)
+ return scope.engine->throwTypeError();
double bo = callData->argc > 1 ? callData->args[1].toNumber() : 0;
uint byteOffset = (uint)bo;
uint bufferLength = buffer->d()->data->size;
double bl = callData->argc < 3 || callData->args[2].isUndefined() ? (bufferLength - bo) : callData->args[2].toNumber();
uint byteLength = (uint)bl;
- if (bo != byteOffset || bl != byteLength || byteOffset + byteLength > bufferLength) {
- scope.result = scope.engine->throwRangeError(QStringLiteral("DataView: constructor arguments out of range"));
- return;
- }
+ if (bo != byteOffset || bl != byteLength || byteOffset + byteLength > bufferLength)
+ return scope.engine->throwRangeError(QStringLiteral("DataView: constructor arguments out of range"));
Scoped<DataView> a(scope, scope.engine->memoryManager->allocObject<DataView>());
a->d()->buffer.set(scope.engine, buffer->d());
a->d()->byteLength = byteLength;
a->d()->byteOffset = byteOffset;
- scope.result = a.asReturnedValue();
+ return a.asReturnedValue();
}
-void DataViewCtor::call(const Managed *that, Scope &scope, CallData *callData)
+ReturnedValue DataViewCtor::call(const Managed *that, CallData *callData)
{
- construct(that, scope, callData);
+ return construct(that, callData);
}
void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor)