Convert a few more builtins into versions that don't need a context
authorLars Knoll <lars.knoll@digia.com>
Wed, 30 Jan 2013 14:10:39 +0000 (15:10 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 30 Jan 2013 14:27:05 +0000 (15:27 +0100)
Change-Id: I24920f3952cd356d50a056891dc075e56c951775
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/v4/qv4booleanobject.cpp
src/v4/qv4booleanobject.h
src/v4/qv4numberobject.cpp
src/v4/qv4numberobject.h
src/v4/qv4stringobject.cpp
src/v4/qv4stringobject.h

index 9df0f23..640773d 100644 (file)
@@ -54,9 +54,9 @@ Value BooleanCtor::construct(ExecutionContext *ctx)
     return Value::fromObject(ctx->engine->newBooleanObject(Value::fromBoolean(n)));
 }
 
-Value BooleanCtor::call(ExecutionContext *ctx)
+Value BooleanCtor::call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc)
 {
-    bool value = ctx->argumentCount ? ctx->argument(0).toBoolean(ctx) : 0;
+    bool value = argc ? argv[0].toBoolean(parentCtx) : 0;
     return Value::fromBoolean(value);
 }
 
index 44d87b1..97dfc50 100644 (file)
@@ -53,7 +53,7 @@ struct BooleanCtor: FunctionObject
     BooleanCtor(ExecutionContext *scope);
 
     virtual Value construct(ExecutionContext *ctx);
-    virtual Value call(ExecutionContext *ctx);
+    virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
 };
 
 struct BooleanPrototype: BooleanObject
index 08711a8..d732297 100644 (file)
@@ -60,9 +60,9 @@ Value NumberCtor::construct(ExecutionContext *ctx)
     return Value::fromObject(ctx->engine->newNumberObject(Value::fromDouble(d)));
 }
 
-Value NumberCtor::call(ExecutionContext *ctx)
+Value NumberCtor::call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc)
 {
-    double d = ctx->argumentCount ? ctx->argument(0).toNumber(ctx) : 0;
+    double d = argc ? argv[0].toNumber(parentCtx) : 0.;
     return Value::fromDouble(d);
 }
 
index 85f9e1f..83fb4ad 100644 (file)
@@ -53,7 +53,7 @@ struct NumberCtor: FunctionObject
     NumberCtor(ExecutionContext *scope);
 
     virtual Value construct(ExecutionContext *ctx);
-    virtual Value call(ExecutionContext *ctx);
+    virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
 };
 
 struct NumberPrototype: NumberObject
index 4b46fc1..4e0285c 100644 (file)
@@ -122,13 +122,13 @@ Value StringCtor::construct(ExecutionContext *ctx)
     return Value::fromObject(ctx->engine->newStringObject(ctx, value));
 }
 
-Value StringCtor::call(ExecutionContext *ctx)
+Value StringCtor::call(ExecutionContext *parentCtx, Value thisObject, 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(parentCtx));
     else
-        value = Value::fromString(ctx, QString());
+        value = Value::fromString(parentCtx, QString());
     return value;
 }
 
index 1becd97..306f00c 100644 (file)
@@ -64,7 +64,7 @@ struct StringCtor: FunctionObject
     StringCtor(ExecutionContext *scope);
 
     virtual Value construct(ExecutionContext *ctx);
-    virtual Value call(ExecutionContext *ctx);
+    virtual Value call(ExecutionContext *parentCtx, Value thisObject, Value *argv, int argc);
 };
 
 struct StringPrototype: StringObject