Showing the changes to libraries/script-engine/src/qtscript/ScriptObjectQtProxy.cpp (1 of 2 files). Show all
Unified · Split
| @@ -205,9 +205,11 @@ void ScriptObjectQtProxy::investigate() { · 204 unmodified lines | |||
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | } else { | 207 | } else { |
| 208 | int parameterCount = method.parameterCount(); | ||
| 208 | if (nameLookup == methodNames.end()) { | 209 | if (nameLookup == methodNames.end()) { |
| 209 | MethodDef& methodDef = _methods.insert(idx, MethodDef()).value(); | 210 | MethodDef& methodDef = _methods.insert(idx, MethodDef()).value(); |
| 210 | methodDef.name = name; | 211 | methodDef.name = name; |
| 212 | methodDef.numMaxParms = parameterCount; | ||
| 211 | methodDef.methods.append(method); | 213 | methodDef.methods.append(method); |
| 212 | methodNames.insert(name, idx); | 214 | methodNames.insert(name, idx); |
| 213 | } else { | 215 | } else { |
| @@ -215,6 +217,7 @@ void ScriptObjectQtProxy::investigate() { · 1 unmodified line | |||
| 215 | MethodDefMap::iterator methodLookup = _methods.find(originalMethodId); | 217 | MethodDefMap::iterator methodLookup = _methods.find(originalMethodId); |
| 216 | Q_ASSERT(methodLookup != _methods.end()); | 218 | Q_ASSERT(methodLookup != _methods.end()); |
| 217 | MethodDef& methodDef = methodLookup.value(); | 219 | MethodDef& methodDef = methodLookup.value(); |
| 220 | if(methodDef.numMaxParms < parameterCount) methodDef.numMaxParms = parameterCount; | ||
| 218 | methodDef.methods.append(method); | 221 | methodDef.methods.append(method); |
| 219 | } | 222 | } |
| 220 | } | 223 | } |
| @@ -312,8 +315,9 @@ QScriptValue ScriptObjectQtProxy::property(const QScriptValue& object, const QSc · 91 unmodified lines | |||
| 312 | int methodId = id & ~TYPE_MASK; | 315 | int methodId = id & ~TYPE_MASK; |
| 313 | MethodDefMap::const_iterator lookup = _methods.find(methodId); | 316 | MethodDefMap::const_iterator lookup = _methods.find(methodId); |
| 314 | if (lookup == _methods.cend()) return QScriptValue(); | 317 | if (lookup == _methods.cend()) return QScriptValue(); |
| 318 | const MethodDef& methodDef = lookup.value(); | ||
| 315 | return static_cast<QScriptEngine*>(_engine)->newObject( | 319 | return static_cast<QScriptEngine*>(_engine)->newObject( |
| 316 | new ScriptMethodQtProxy(_engine, qobject, object, lookup.value().methods)); | 320 | new ScriptMethodQtProxy(_engine, qobject, object, methodDef.methods, methodDef.numMaxParms)); |
| 317 | } | 321 | } |
| 318 | case SIGNAL_TYPE: { | 322 | case SIGNAL_TYPE: { |
| 319 | int signalId = id & ~TYPE_MASK; | 323 | int signalId = id & ~TYPE_MASK; |
| @@ -430,8 +434,7 @@ QVariant ScriptMethodQtProxy::extension(Extension extension, const QVariant& arg · 110 unmodified lines | |||
| 430 | } | 434 | } |
| 431 | 435 | ||
| 432 | int scriptNumArgs = context->argumentCount(); | 436 | int scriptNumArgs = context->argumentCount(); |
| 433 | Q_ASSERT(scriptNumArgs < 10); | 437 | int numArgs = std::min(scriptNumArgs, _numMaxParms); |
| 434 | int numArgs = std::min(scriptNumArgs, 10); | ||
| 435 | 438 | ||
| 436 | const int scriptValueTypeId = qMetaTypeId<ScriptValue>(); | 439 | const int scriptValueTypeId = qMetaTypeId<ScriptValue>(); |
| 437 | 440 | ||