aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2011-03-15 12:11:00 +1000
committerCharles Yin <charles.yin@nokia.com>2011-05-16 10:22:39 +1000
commit68d18d77ebac49c2b863c425969c70c5426864cd (patch)
tree24625ca544c98989a97f4124dd8ae033dc73ec9f /src
parentcefe75f49321d96e643d7634544f3fde2879eacf (diff)
uses the cached argument info
Change-Id: I884516c9c20425bfd17a2db7d5541fbc5cff41c6 (cherry picked from commit b4613a346effee81f10bee99a6a8d3064cbdd13e)
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp25
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass_p.h2
2 files changed, 6 insertions, 21 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index edc1755a72..f4ca9fe758 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -672,7 +672,7 @@ struct MetaCallArgument {
inline void *dataPtr();
inline void initAsType(int type, QDeclarativeEngine *);
- void fromScriptValue(int type, QDeclarativeEngine *, const QScriptValue &);
+ inline void fromScriptValue(int type, QDeclarativeEngine *, const QScriptValue &);
inline QScriptDeclarativeClass::Value toValue(QDeclarativeEngine *);
private:
@@ -908,24 +908,9 @@ QDeclarativeObjectMethodScriptClass::callPrecise(QObject *object, const QDeclara
QScriptContext *ctxt)
{
if (data.flags & QDeclarativePropertyCache::Data::HasArguments) {
-
- QMetaMethod m = object->metaObject()->method(data.coreIndex);
- QList<QByteArray> argTypeNames = m.parameterTypes();
- QVarLengthArray<int, 9> argTypes(argTypeNames.count());
-
- // ### Cache
- for (int ii = 0; ii < argTypeNames.count(); ++ii) {
- argTypes[ii] = QMetaType::type(argTypeNames.at(ii));
- if (argTypes[ii] == QVariant::Invalid)
- argTypes[ii] = enumType(object->metaObject(), QString::fromLatin1(argTypeNames.at(ii)));
- if (argTypes[ii] == QVariant::Invalid)
- return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii)))));
- }
-
- if (argTypes.count() > ctxt->argumentCount())
- return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments")));
-
- return callMethod(object, data.coreIndex, data.propType, argTypes.count(), argTypes.data(), ctxt);
+ if (data.paramTypes.size() > ctxt->argumentCount())
+ return Value(ctxt, ctxt->throwError(QLatin1String("Insufficient arguments")));
+ return callMethod(object, data.coreIndex, data.propType, data.paramTypes.size(), data.paramTypes.data(), ctxt);
} else {
@@ -936,7 +921,7 @@ QDeclarativeObjectMethodScriptClass::callPrecise(QObject *object, const QDeclara
QDeclarativeObjectMethodScriptClass::Value
QDeclarativeObjectMethodScriptClass::callMethod(QObject *object, int index,
- int returnType, int argCount, int *argTypes,
+ int returnType, int argCount, const int *argTypes,
QScriptContext *ctxt)
{
if (argCount > 0) {
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
index 850a94f364..24fcbda106 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h
@@ -85,7 +85,7 @@ private:
Value callPrecise(QObject *, const QDeclarativePropertyCache::Data &, QScriptContext *);
Value callOverloaded(MethodData *, QScriptContext *);
- Value callMethod(QObject *, int index, int returnType, int argCount, int *argTypes, QScriptContext *ctxt);
+ Value callMethod(QObject *, int index, int returnType, int argCount, const int *argTypes, QScriptContext *ctxt);
int matchScore(const QScriptValue &, int, const QByteArray &);
QDeclarativePropertyCache::Data *relatedMethod(QObject *, QDeclarativePropertyCache::Data *current,