Also accept a boolean primitive as input to
Boolean.prototype.valueOf()
Change-Id: I5b94d8d65b86e26860b9844eb4bf823577c8e924
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
ReturnedValue BooleanPrototype::method_valueOf(SimpleCallContext *ctx)
{
- // ### Shouldn't this work for a boolean thisObject?
+ if (ctx->callData->thisObject.isBoolean())
+ return ctx->callData->thisObject.asReturnedValue();
+
Scope scope(ctx);
Scoped<BooleanObject> thisObject(scope, ctx->callData->thisObject);
if (!thisObject)
protected:
BooleanObject(InternalClass *ic)
: Object(ic) {
+ vtbl = &static_vtbl;
type = Type_BooleanObject;
value = Encode(false);
}
protected:
NumberObject(InternalClass *ic)
: Object(ic) {
+ vtbl = &static_vtbl;
type = Type_NumberObject;
value = Encode((int)0);
}