diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-09 22:23:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-12 21:52:31 +0200 |
commit | 22a5c163d3f74efe8c15c61de6f7334810bc1bc2 (patch) | |
tree | 83ee1c1b9bdcd46c90031848c1800d26ddca552b /src/qml/jsruntime/qv4runtime.cpp | |
parent | c2c038ae942c534555018ebae71f20334348e46c (diff) |
Change binops to use ReturnedValue
Change-Id: I068b1af5c352fc84793079e5bccbe3482b04cafa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 3d9c5f9a81..e132172411 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -274,7 +274,7 @@ ReturnedValue __qmljs_delete_name(ExecutionContext *ctx, String *name) return Value::fromBoolean(ctx->deleteProperty(name)); } -void __qmljs_add_helper(ExecutionContext *ctx, ValueRef result, const ValueRef left, const ValueRef right) +QV4::ReturnedValue __qmljs_add_helper(ExecutionContext *ctx, const ValueRef left, const ValueRef right) { ValueScope scope(ctx); @@ -286,39 +286,37 @@ void __qmljs_add_helper(ExecutionContext *ctx, ValueRef result, const ValueRef l if (!pright->isString()) pright = __qmljs_to_string(pright, ctx); String *string = __qmljs_string_concat(ctx, pleft->stringValue(), pright->stringValue()); - *result = Value::fromString(string); - return; + return Value::fromString(string); } double x = __qmljs_to_number(pleft); double y = __qmljs_to_number(pright); - *result = Value::fromDouble(x + y); + return Value::fromDouble(x + y); } -void __qmljs_instanceof(ExecutionContext *ctx, ValueRef result, const ValueRef left, const ValueRef right) +QV4::ReturnedValue __qmljs_instanceof(ExecutionContext *ctx, const ValueRef left, const ValueRef right) { Object *o = right->asObject(); if (!o) ctx->throwTypeError(); bool r = o->hasInstance(*left); - *result = Value::fromBoolean(r); + return Value::fromBoolean(r); } -void __qmljs_in(ExecutionContext *ctx, ValueRef result, const ValueRef left, const ValueRef right) +QV4::ReturnedValue __qmljs_in(ExecutionContext *ctx, const ValueRef left, const ValueRef right) { if (!right->isObject()) ctx->throwTypeError(); String *s = left->toString(ctx); bool r = right->objectValue()->__hasProperty__(s); - *result = Value::fromBoolean(r); + return Value::fromBoolean(r); } static void inplaceBitOp(ExecutionContext *ctx, String *name, const ValueRef value, BinOp op) { ValueScope scope(ctx); ScopedValue lhs(scope, ctx->getProperty(name)); - ScopedValue result(scope); - op(result, lhs, value); + ScopedValue result(scope, op(lhs, value)); ctx->setProperty(name, result); } @@ -342,8 +340,7 @@ void __qmljs_inplace_add_name(ExecutionContext *ctx, String *name, const ValueRe { ValueScope scope(ctx); ScopedValue lhs(scope, ctx->getProperty(name)); - ScopedValue result(scope); - __qmljs_add(ctx, result, lhs, value); + ScopedValue result(scope, __qmljs_add(ctx, lhs, value)); ctx->setProperty(name, result); } |