Check for the number of arguments, not whether the first arg
is undefined.
Change-Id: I23829404dfd4547f829b1bc7a4407017d79f7162
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Value StringCtor::call(ExecutionContext *ctx)
{
- const Value arg = ctx->argument(0);
- if (arg.isUndefined())
- return Value::fromString(ctx->engine->newString(QString()));
+ Value value;
+ if (ctx->argumentCount)
+ value = Value::fromString(ctx->argument(0).toString(ctx));
else
- return __qmljs_to_string(arg, ctx);
+ value = Value::fromString(ctx, QString());
+ return value;
}
void StringPrototype::init(ExecutionContext *ctx, const Value &ctor)