From 119e2edb3ea52a6b3b9da6183dc0fcf350ba8431 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 5 Jan 2017 15:14:37 +0100 Subject: Convert more builtin functions Change-Id: I2dc8797e2240fcfc4176cb08b982e3e98b879646 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4include.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/qml/jsruntime/qv4include.cpp') diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index 1d393cf0aa..f033eb2d2d 100644 --- a/src/qml/jsruntime/qv4include.cpp +++ b/src/qml/jsruntime/qv4include.cpp @@ -195,23 +195,22 @@ void QV4Include::finished() /* Documented in qv8engine.cpp */ -QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx) +void QV4Include::method_include(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData) { - if (!ctx->argc()) - return QV4::Encode::undefined(); + if (!callData->argc) + RETURN_UNDEFINED(); - QV4::Scope scope(ctx->engine()); QQmlContextData *context = scope.engine->callingQmlContext(); if (!context || !context->isJSContext) - V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files"); + RETURN_RESULT(scope.engine->throwError(QString::fromUtf8("Qt.include(): Can only be called from JavaScript files"))); QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue()); - if (ctx->argc() >= 2 && ctx->args()[1].as()) - callbackFunction = ctx->args()[1]; + if (callData->argc >= 2 && callData->args[1].as()) + callbackFunction = callData->args[1]; #if QT_CONFIG(qml_network) - QUrl url(scope.engine->resolvedUrl(ctx->args()[0].toQStringNoThrow())); + QUrl url(scope.engine->resolvedUrl(callData->args[0].toQStringNoThrow())); if (scope.engine->qmlEngine() && scope.engine->qmlEngine()->urlInterceptor()) url = scope.engine->qmlEngine()->urlInterceptor()->intercept(url, QQmlAbstractUrlInterceptor::JavaScriptFile); @@ -261,12 +260,12 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx) callback(callbackFunction, result); } - return result->asReturnedValue(); + scope.result = result; #else QV4::ScopedValue result(scope); result = resultValue(scope.engine, NetworkError); callback(callbackFunction, result); - return result->asReturnedValue(); + scope.result = result; #endif } -- cgit v1.2.3