aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4functionobject.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-07-28 10:07:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-04 20:17:54 +0100
commit486948817b26da2c62802bb93a0f671715c609d4 (patch)
tree45cd51615a6d187ac504c18c4dee4aa31cf9a771 /src/qml/jsruntime/qv4functionobject.cpp
parent6f6b350976ccfe959223b1fbe8c21fe71efc45bd (diff)
Move the throw methods from ExecutionContext to ExecutionEngine
The methods don't require a context, and thus shouldn't be implemented there. Change-Id: If058e0c5067093a4161f2275ac4288aa2bc500f3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4functionobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 49a560d092..417aaff756 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -143,7 +143,7 @@ ReturnedValue FunctionObject::newInstance()
ReturnedValue FunctionObject::construct(Managed *that, CallData *)
{
- that->internalClass()->engine->currentContext()->throwTypeError();
+ that->internalClass()->engine->throwTypeError();
return Encode::undefined();
}
@@ -208,12 +208,12 @@ ReturnedValue FunctionCtor::construct(Managed *that, CallData *callData)
const bool parsed = parser.parseExpression();
if (!parsed)
- return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
+ return v4->throwSyntaxError(QLatin1String("Parse error"));
using namespace QQmlJS::AST;
FunctionExpression *fe = QQmlJS::AST::cast<FunctionExpression *>(parser.rootNode());
if (!fe)
- return v4->currentContext()->throwSyntaxError(QLatin1String("Parse error"));
+ return v4->throwSyntaxError(QLatin1String("Parse error"));
IR::Module module(v4->debugger != 0);
@@ -262,7 +262,7 @@ ReturnedValue FunctionPrototype::method_toString(CallContext *ctx)
{
FunctionObject *fun = ctx->d()->callData->thisObject.asFunctionObject();
if (!fun)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
return ctx->d()->engine->newString(QStringLiteral("function() { [code] }"))->asReturnedValue();
}
@@ -272,7 +272,7 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
Scope scope(ctx);
FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue arg(scope, ctx->argument(1));
@@ -282,7 +282,7 @@ ReturnedValue FunctionPrototype::method_apply(CallContext *ctx)
if (!arr) {
len = 0;
if (!arg->isNullOrUndefined())
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
} else {
len = arr->getLength();
}
@@ -314,7 +314,7 @@ ReturnedValue FunctionPrototype::method_call(CallContext *ctx)
FunctionObject *o = ctx->d()->callData->thisObject.asFunctionObject();
if (!o)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedCallData callData(scope, ctx->d()->callData->argc ? ctx->d()->callData->argc - 1 : 0);
if (ctx->d()->callData->argc) {
@@ -330,7 +330,7 @@ ReturnedValue FunctionPrototype::method_bind(CallContext *ctx)
Scope scope(ctx);
Scoped<FunctionObject> target(scope, ctx->d()->callData->thisObject);
if (!target)
- return ctx->throwTypeError();
+ return ctx->engine()->throwTypeError();
ScopedValue boundThis(scope, ctx->argument(0));
Members boundArgs;
@@ -539,7 +539,7 @@ BuiltinFunction::Data::Data(ExecutionContext *scope, String *name, ReturnedValue
ReturnedValue BuiltinFunction::construct(Managed *f, CallData *)
{
- return f->internalClass()->engine->currentContext()->throwTypeError();
+ return f->internalClass()->engine->throwTypeError();
}
ReturnedValue BuiltinFunction::call(Managed *that, CallData *callData)