ctx->hasUncaughtException = false;
if (! ctx->activation.isObject())
- ctx->activation = __qmljs_init_object(new QQmlJS::VM::Object());
+ ctx->activation = VM::Value::fromObject(new QQmlJS::VM::Object());
foreach (const QString *local, globalCode->locals) {
ctx->activation.objectValue()->setProperty(ctx, *local, QQmlJS::VM::Value::undefinedValue());
void FunctionObject::construct(Context *ctx)
{
- ctx->thisObject = __qmljs_init_object(ctx->engine->newObject());
+ ctx->thisObject = Value::fromObject(ctx->engine->newObject());
call(ctx);
}
Value proto = getProperty(ctx, ctx->engine->id_prototype);
if (proto.isObject())
obj->prototype = proto.objectValue();
- ctx->thisObject = __qmljs_init_object(obj);
+ ctx->thisObject = Value::fromObject(obj);
function->code(ctx, function->codeData);
}
// set up the global object
//
VM::Object *glo = newObject(/*rootContext*/);
- globalObject = __qmljs_init_object(glo);
- rootContext->activation = __qmljs_init_object(glo);
+ globalObject = Value::fromObject(glo);
+ rootContext->activation = Value::fromObject(glo);
glo->setProperty(rootContext, identifier(QStringLiteral("Object")), objectCtor);
glo->setProperty(rootContext, identifier(QStringLiteral("String")), stringCtor);
result = Value::undefinedValue();
if (f->needsActivation)
- activation = __qmljs_init_object(engine->newActivationObject(this));
+ activation = Value::fromObject(engine->newActivationObject(this));
else
activation = Value::nullValue();
Value __qmljs_init_closure(IR::Function *clos, Context *ctx)
{
- return __qmljs_init_object(ctx->engine->newScriptFunction(ctx, clos));
+ return Value::fromObject(ctx->engine->newScriptFunction(ctx, clos));
}
Value __qmljs_init_native_function(void (*code)(Context *), Context *ctx)
{
- return __qmljs_init_object(ctx->engine->newNativeFunction(ctx, code));
+ return Value::fromObject(ctx->engine->newNativeFunction(ctx, code));
}
Value __qmljs_string_literal_undefined(Context *ctx)
Value __qmljs_new_object(Context *ctx)
{
- return __qmljs_init_object(ctx->engine->newObject());
+ return Value::fromObject(ctx->engine->newObject());
}
Value __qmljs_new_boolean_object(Context *ctx, bool boolean)
{
Value value = Value::fromBoolean(boolean);
- return __qmljs_init_object(ctx->engine->newBooleanObject(value));
+ return Value::fromObject(ctx->engine->newBooleanObject(value));
}
Value __qmljs_new_number_object(Context *ctx, double number)
{
Value value = Value::fromDouble(number);
- return __qmljs_init_object(ctx->engine->newNumberObject(value));
+ return Value::fromObject(ctx->engine->newNumberObject(value));
}
Value __qmljs_new_string_object(Context *ctx, String *string)
{
Value value = Value::fromString(string);
- return __qmljs_init_object(ctx->engine->newStringObject(value));
+ return Value::fromObject(ctx->engine->newStringObject(value));
}
void __qmljs_set_property(Context *ctx, Value object, String *name, Value value)
Value __qmljs_builtin_rethrow(Context *context);
// constructors
-Value __qmljs_init_object(Object *object);
Value __qmljs_init_closure(IR::Function *clos, Context *ctx);
Value __qmljs_init_native_function(void (*code)(Context *), Context *ctx);
extern "C" {
-// constructors
-
-inline Value __qmljs_init_object(Object *object)
-{
- return Value::fromObject(object);
-}
-
// type conversion and testing
inline Value __qmljs_to_primitive(Value value, Context *ctx, int typeHint)
{
void ObjectCtor::construct(Context *ctx)
{
- ctx->thisObject = __qmljs_init_object(ctx->engine->newObject());
+ ctx->thisObject = Value::fromObject(ctx->engine->newObject());
}
void ObjectCtor::call(Context *ctx)
{
- ctx->result = __qmljs_init_object(ctx->engine->newObject());
+ ctx->result = Value::fromObject(ctx->engine->newObject());
}
Value ObjectCtor::getProperty(Context *ctx, String *name, PropertyAttributes *attributes)
value = Value::fromString(ctx->argument(0).toString(ctx));
else
value = Value::fromString(ctx, QString());
- ctx->thisObject = __qmljs_init_object(ctx->engine->newStringObject(value));
+ ctx->thisObject = Value::fromObject(ctx->engine->newStringObject(value));
}
void StringCtor::call(Context *ctx)
void NumberCtor::construct(Context *ctx)
{
const double n = ctx->argument(0).toNumber(ctx);
- ctx->thisObject = __qmljs_init_object(ctx->engine->newNumberObject(Value::fromDouble(n)));
+ ctx->thisObject = Value::fromObject(ctx->engine->newNumberObject(Value::fromDouble(n)));
}
void NumberCtor::call(Context *ctx)
void BooleanCtor::construct(Context *ctx)
{
const double n = ctx->argument(0).toBoolean(ctx);
- ctx->thisObject = __qmljs_init_object(ctx->engine->newBooleanObject(Value::fromBoolean(n)));
+ ctx->thisObject = Value::fromObject(ctx->engine->newBooleanObject(Value::fromBoolean(n)));
}
void BooleanCtor::call(Context *ctx)
void RegExpCtor::construct(Context *ctx)
{
- ctx->thisObject = __qmljs_init_object(ctx->engine->newStringObject(Value::undefinedValue()));
+ ctx->thisObject = Value::fromObject(ctx->engine->newStringObject(Value::undefinedValue()));
}
void RegExpCtor::call(Context *ctx)
{
- ctx->result = __qmljs_init_object(ctx->engine->newRegExpObject(Value::undefinedValue()));
+ ctx->result = Value::fromObject(ctx->engine->newRegExpObject(Value::undefinedValue()));
}
void RegExpPrototype::init(Context *ctx, const Value &ctor)