Q_ASSERT(vmeMetaObject); // the fact we found the property above should guarentee this
int lineNumber = vmeMetaObject->vmeMethodLineNumber(prop->coreIndex);
- vmeMetaObject->setVmeMethod(prop->coreIndex, QDeclarativeExpressionPrivate::evalInObjectScope(contextData, object, jsfunction, contextData->url.toString(), lineNumber, 0));
+ vmeMetaObject->setVmeMethod(prop->coreIndex, QDeclarativeExpressionPrivate::evalFunction(contextData, object, jsfunction, contextData->url.toString(), lineNumber));
}
void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value)
return v8::Persistent<v8::Function>::New(v8::Local<v8::Function>::Cast(result));
}
-QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContextData *context, QObject *object,
- const QString &program, const QString &fileName,
- int lineNumber, QScriptValue *contextObject)
-{
-#if 0
- QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine);
- QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
- if (contextObject) {
- *contextObject = ep->contextClass->newContext(context, object);
- scriptContext->pushScope(*contextObject);
- } else {
- scriptContext->pushScope(ep->contextClass->newContext(context, object));
- }
- scriptContext->pushScope(ep->globalClass->staticGlobalObject());
- QScriptValue rv = ep->scriptEngine.evaluate(program, fileName, lineNumber);
- ep->scriptEngine.popContext();
- return rv;
-#else
- qFatal("Not impl");
-#endif
-}
-
-QScriptValue QDeclarativeExpressionPrivate::evalInObjectScope(QDeclarativeContextData *context, QObject *object,
- const QScriptProgram &program,
- QScriptValue *contextObject)
-{
-#if 0
- QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(context->engine);
- QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(&ep->scriptEngine);
- if (contextObject) {
- *contextObject = ep->contextClass->newContext(context, object);
- scriptContext->pushScope(*contextObject);
- } else {
- scriptContext->pushScope(ep->contextClass->newContext(context, object));
- }
- scriptContext->pushScope(ep->globalClass->staticGlobalObject());
- QScriptValue rv = ep->scriptEngine.evaluate(program);
- ep->scriptEngine.popContext();
- return rv;
-#else
- qFatal("Not impl");
-#endif
-}
-
/*!
\class QDeclarativeExpression
\since 4.7
static void exceptionToError(QScriptEngine *, QDeclarativeError &);
static void exceptionToError(v8::Handle<v8::Message>, QDeclarativeError &);
- static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QString &, const QString &,
- int, QScriptValue *);
- static QScriptValue evalInObjectScope(QDeclarativeContextData *, QObject *, const QScriptProgram &,
- QScriptValue *);
-
static v8::Persistent<v8::Function> evalFunction(QDeclarativeContextData *ctxt, QObject *scope,
const QString &code, const QString &filename, int line,
v8::Persistent<v8::Object> *qmlscope = 0);
}
// Used by debugger
-void QDeclarativeVMEMetaObject::setVmeMethod(int index, const QScriptValue &value)
+void QDeclarativeVMEMetaObject::setVmeMethod(int index, v8::Persistent<v8::Function> value)
{
if (index < methodOffset) {
Q_ASSERT(parent);
int plainSignals = metaData->signalCount + metaData->propertyCount + metaData->aliasCount;
Q_ASSERT(index >= (methodOffset + plainSignals) && index < (methodOffset + plainSignals + metaData->methodCount));
-#if 0
- if (!methods)
- methods = new QScriptValue[metaData->methodCount];
- methods[index - methodOffset - plainSignals] = value;
-#endif
+ if (!v8methods)
+ v8methods = new v8::Persistent<v8::Function>[metaData->methodCount];
+
+ int methodIndex = index - methodOffset - plainSignals;
+ if (!v8methods[methodIndex].IsEmpty())
+ v8methods[methodIndex].Dispose();
+ v8methods[methodIndex] = value;
}
#if 0
void registerInterceptor(int index, int valueIndex, QDeclarativePropertyValueInterceptor *interceptor);
v8::Handle<v8::Function> vmeMethod(int index);
int vmeMethodLineNumber(int index);
- void setVmeMethod(int index, const QScriptValue &);
+ void setVmeMethod(int index, v8::Persistent<v8::Function>);
#if 0
QScriptValue vmeProperty(int index);
void setVMEProperty(int index, const QScriptValue &);
QBitArray aInterceptors;
QHash<int, QPair<int, QDeclarativePropertyValueInterceptor*> > interceptors;
- QScriptValue *methods;
v8::Persistent<v8::Function> *v8methods;
v8::Handle<v8::Function> method(int);
SUBDIRS += \
examples \
+ geometry \
+ node \
parserstress \
qdeclarativecomponent \
qdeclarativecontext \
qdeclarativeconnection \
qdeclarativedebug \
qdeclarativedebugclient \
+ qdeclarativedebughelper \
qdeclarativedebugservice \
qdeclarativeecmascript \
qdeclarativeflickable \
qdeclarativeproperty \
qdeclarativepropertymap \
qdeclarativerepeater \
+ qdeclarativescriptdebugging \
qdeclarativesmoothedanimation \
qdeclarativespringanimation \
qdeclarativestyledtext \