{
}
-Value ErrorCtor::construct(ExecutionContext *context, Value *args, int argc)
+Value ErrorCtor::construct(ExecutionContext *ctx, Value *args, int argc)
{
- return Value::fromObject(context->engine->newErrorObject(argc ? args[0] : Value::undefinedValue()));
+ return Value::fromObject(ctx->engine->newErrorObject(argc ? args[0] : Value::undefinedValue()));
}
Value ErrorCtor::call(ExecutionContext *ctx, Value thisObject, Value *args, int argc)
{
ErrorCtor(ExecutionContext *scope);
- virtual Value construct(ExecutionContext *context, Value *args, int argc);
+ virtual Value construct(ExecutionContext *ctx, Value *args, int argc);
virtual Value call(ExecutionContext *ctx, Value thisObject, Value *args, int argc);
};
ctx->argumentCount = argc;
ctx->initCallContext(context);
- Value result = construct(ctx);
+ Value result = call(ctx);
ctx->leaveCallContext();
if (result.isObject())
return Value::undefinedValue();
}
-Value FunctionObject::construct(ExecutionContext *ctx)
-{
- return call(ctx);
-}
-
const ManagedVTable FunctionObject::static_vtbl =
{
FunctionObject::markObjects,
protected:
virtual Value call(ExecutionContext *ctx);
- virtual Value construct(ExecutionContext *ctx);
static const ManagedVTable static_vtbl;
static void markObjects(Managed *that);
{
}
-Value RegExpCtor::construct(ExecutionContext *ctx)
+Value RegExpCtor::construct(ExecutionContext *ctx, Value *argv, int argc)
{
- Value r = ctx->argumentCount > 0 ? ctx->argument(0) : Value::undefinedValue();
- Value f = ctx->argumentCount > 1 ? ctx->argument(1) : Value::undefinedValue();
+ Value r = argc > 0 ? argv[0] : Value::undefinedValue();
+ Value f = argc > 1 ? argv[1] : Value::undefinedValue();
if (RegExpObject *re = r.asRegExpObject()) {
if (!f.isUndefined())
ctx->throwTypeError();
return Value::fromObject(o);
}
-Value RegExpCtor::call(ExecutionContext *ctx)
+Value RegExpCtor::call(ExecutionContext *ctx, Value thisObject, Value *argv, int argc)
{
- if (ctx->argumentCount > 0 && ctx->argument(0).asRegExpObject()) {
- if (ctx->argumentCount == 1 || ctx->argument(1).isUndefined())
- return ctx->argument(0);
+ if (argc > 0 && argv[0].asRegExpObject()) {
+ if (argc == 1 || argv[1].isUndefined())
+ return argv[0];
}
- return construct(ctx);
+ return construct(ctx, argv, argc);
}
void RegExpPrototype::init(ExecutionContext *ctx, const Value &ctor)
{
RegExpCtor(ExecutionContext *scope);
- virtual Value construct(ExecutionContext *ctx);
- virtual Value call(ExecutionContext *ctx);
+ virtual Value construct(ExecutionContext *ctx, Value *argv, int argc);
+ virtual Value call(ExecutionContext *ctx, Value thisObject, Value *argv, int argc);
};
struct RegExpPrototype: RegExpObject
{
}
-Value StringCtor::construct(ExecutionContext *ctx)
+Value StringCtor::construct(ExecutionContext *ctx, Value *argv, int argc)
{
Value value;
- if (ctx->argumentCount)
- value = Value::fromString(ctx->argument(0).toString(ctx));
+ if (argc)
+ value = Value::fromString(argv[0].toString(ctx));
else
value = Value::fromString(ctx, QString());
return Value::fromObject(ctx->engine->newStringObject(ctx, value));
{
StringCtor(ExecutionContext *scope);
- virtual Value construct(ExecutionContext *ctx);
+ virtual Value construct(ExecutionContext *ctx, Value *argv, int argc);
virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
};