diff options
author | Lars Knoll <[email protected]> | 2017-01-05 13:39:38 +0100 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2017-01-25 08:31:17 +0000 |
commit | afc29a54791e70264f7c175b2da0a234f791f749 (patch) | |
tree | ea591cd4322c861e0aeb5cd5f5ae3fdfecb6cc66 /src/qml/jsruntime/qv4booleanobject.cpp | |
parent | cea4a039d713173d423c35fa56a6994a4ebefd2c (diff) |
Convert more builtin methods to the new calling convention
Change-Id: I2cd1df437d91918001beed8dfe92d553b3bb377f
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4booleanobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4booleanobject.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4booleanobject.cpp b/src/qml/jsruntime/qv4booleanobject.cpp index 8047993266..601066110f 100644 --- a/src/qml/jsruntime/qv4booleanobject.cpp +++ b/src/qml/jsruntime/qv4booleanobject.cpp @@ -73,29 +73,31 @@ void BooleanPrototype::init(ExecutionEngine *engine, Object *ctor) defineDefaultProperty(engine->id_valueOf(), method_valueOf); } -ReturnedValue BooleanPrototype::method_toString(CallContext *ctx) +void BooleanPrototype::method_toString(const BuiltinFunction *, Scope &scope, CallData *callData) { bool result; - if (ctx->thisObject().isBoolean()) { - result = ctx->thisObject().booleanValue(); + if (callData->thisObject.isBoolean()) { + result = callData->thisObject.booleanValue(); } else { - const BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>(); + const BooleanObject *thisObject = callData->thisObject.as<BooleanObject>(); if (!thisObject) - return ctx->engine()->throwTypeError(); + THROW_TYPE_ERROR(); result = thisObject->value(); } - return Encode(ctx->d()->engine->newString(QLatin1String(result ? "true" : "false"))); + scope.result = scope.engine->newString(QLatin1String(result ? "true" : "false")); } -ReturnedValue BooleanPrototype::method_valueOf(CallContext *ctx) +void BooleanPrototype::method_valueOf(const BuiltinFunction *, Scope &scope, CallData *callData) { - if (ctx->thisObject().isBoolean()) - return ctx->thisObject().asReturnedValue(); + if (callData->thisObject.isBoolean()) { + scope.result = callData->thisObject.asReturnedValue(); + return; + } - const BooleanObject *thisObject = ctx->thisObject().as<BooleanObject>(); + const BooleanObject *thisObject = callData->thisObject.as<BooleanObject>(); if (!thisObject) - return ctx->engine()->throwTypeError(); + THROW_TYPE_ERROR(); - return Encode(thisObject->value()); + scope.result = Encode(thisObject->value()); } |