aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-06-12 13:07:39 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-19 15:24:55 +0000
commit9fd6ccb582166b684550a5805e895292302b4e12 (patch)
tree5c631d94d6c056ee05507c6a4a0df17880fb9816
parent1bedf1aead29cd3030969e855958185990def071 (diff)
Smaller code cleanups
Change-Id: Id3bc6ea5615a462d7a41ceb1fa18b4fb090e0d51 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
-rw-r--r--src/qml/jsruntime/qv4context.cpp2
-rw-r--r--src/qml/jsruntime/qv4context_p.h2
-rw-r--r--src/qml/jsruntime/qv4functionobject_p.h4
-rw-r--r--src/qml/jsruntime/qv4script.cpp18
4 files changed, 11 insertions, 15 deletions
diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp
index 2ce4d85e8c..20ed07fa2e 100644
--- a/src/qml/jsruntime/qv4context.cpp
+++ b/src/qml/jsruntime/qv4context.cpp
@@ -52,7 +52,7 @@ DEFINE_MANAGED_VTABLE(CatchContext);
DEFINE_MANAGED_VTABLE(GlobalContext);
DEFINE_MANAGED_VTABLE(QmlContext);
-Heap::CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
+Heap::CallContext *ExecutionContext::newCallContext(const FunctionObject *function, CallData *callData)
{
Q_ASSERT(function->function());
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 41457312f4..8eda4ed12c 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -146,7 +146,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
ExecutionEngine *engine() const { return d()->engine; }
- Heap::CallContext *newCallContext(FunctionObject *f, CallData *callData);
+ Heap::CallContext *newCallContext(const FunctionObject *f, CallData *callData);
Heap::WithContext *newWithContext(Object *with);
Heap::CatchContext *newCatchContext(String *exceptionVarName, const Value &exceptionValue);
Heap::QmlContext *newQmlContext(QmlContextWrapper *qml);
diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h
index 67a929554b..930b65156f 100644
--- a/src/qml/jsruntime/qv4functionobject_p.h
+++ b/src/qml/jsruntime/qv4functionobject_p.h
@@ -121,8 +121,8 @@ struct Q_QML_EXPORT FunctionObject: Object {
Function *function() const { return d()->function; }
ReturnedValue name() const;
- unsigned int formalParameterCount() { return d()->formalParameterCount(); }
- unsigned int varCount() { return d()->varCount(); }
+ unsigned int formalParameterCount() const { return d()->formalParameterCount(); }
+ unsigned int varCount() const { return d()->varCount(); }
void init(String *name, bool createProto);
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 767614c137..576488275e 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -98,12 +98,10 @@ Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Functio
function->compilationUnit->addref();
Scope s(scope);
- Scoped<QV4::QmlBindingWrapper> o(s, this);
+ Scoped<QV4::QmlBindingWrapper> protectThis(s, this);
- o->defineReadonlyProperty(scope->d()->engine->id_length(), Primitive::fromInt32(1));
-
- o->d()->scope = ScopedContext(s, o->scope())->newQmlContext(qml);
- s.engine->popContext();
+ this->scope = scope->newQmlContext(qml);
+ internalClass->engine->popContext();
}
Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::QmlContextWrapper *qml)
@@ -113,23 +111,21 @@ Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Qm
Q_ASSERT(scope->inUse());
Scope s(scope);
- Scoped<QV4::QmlBindingWrapper> o(s, this);
-
- o->defineReadonlyProperty(scope->d()->engine->id_length(), Primitive::fromInt32(1));
+ Scoped<QV4::QmlBindingWrapper> protectThis(s, this);
- o->d()->scope = ScopedContext(s, o->scope())->newQmlContext(qml);
- s.engine->popContext();
+ this->scope = scope->newQmlContext(qml);
+ internalClass->engine->popContext();
}
ReturnedValue QmlBindingWrapper::call(const Managed *that, CallData *callData)
{
+ const QmlBindingWrapper *This = static_cast<const QmlBindingWrapper *>(that);
ExecutionEngine *v4 = static_cast<const Object *>(that)->engine();
if (v4->hasException)
return Encode::undefined();
CHECK_STACK_LIMITS(v4);
Scope scope(v4);
- Scoped<QmlBindingWrapper> This(scope, static_cast<const QmlBindingWrapper *>(that));
QV4::Function *f = This->function();
if (!f)
return QV4::Encode::undefined();