QV4::ExecutionContext *ctx = QV8Engine::getV4(v8engine)->current;
try {
- script->m_program->qml = qmlglobal.asObject();
+ script->m_program->qml = qmlglobal;
script->m_program->run();
} catch (QV4::Exception &e) {
e.accept(ctx);
}
static Value call(Managed *that, ExecutionContext *, const Value &, Value *, int);
+ static void markObjects(Managed *m)
+ {
+ QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m);
+ if (wrapper->qml)
+ wrapper->qml->mark();
+ FunctionObject::markObjects(m);
+ }
protected:
static const ManagedVTable static_vtbl;
if (engine->debugger)
engine->debugger->aboutToCall(0, scope);
- if (!qml) {
+ if (qml.isEmpty()) {
TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);
bool strict = scope->strictMode;
return result;
} else {
- FunctionObject *f = new (engine->memoryManager) QmlBindingWrapper(scope, vmFunction, qml);
+ FunctionObject *f = new (engine->memoryManager) QmlBindingWrapper(scope, vmFunction, qml.value().asObject());
return f->call(Value::undefinedValue(), 0, 0);
}
}
if (!parsed)
parse();
QV4::ExecutionEngine *v4 = scope->engine;
- return Value::fromObject(new (v4->memoryManager) QmlBindingWrapper(scope, vmFunction, qml));
+ return Value::fromObject(new (v4->memoryManager) QmlBindingWrapper(scope, vmFunction, qml.value().asObject()));
}
QV4::Value Script::evaluate(ExecutionEngine *engine, const QString &script, Object *scopeObject)
struct Q_QML_EXPORT Script {
Script(ExecutionContext *scope, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
- , scope(scope), strictMode(false), inheritContext(false), parsed(false), qml(0)
+ , scope(scope), strictMode(false), inheritContext(false), parsed(false)
, vmFunction(0) {}
Script(ExecutionEngine *engine, Object *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, scope(engine->rootContext), strictMode(true), inheritContext(true), parsed(false)
- , qml(qml), vmFunction(0) {}
+ , qml(Value::fromObject(qml)), vmFunction(0) {}
QString sourceFile;
int line;
int column;
bool strictMode;
bool inheritContext;
bool parsed;
- Object *qml;
+ QV4::PersistentValue qml;
Function *vmFunction;
void parse();