diff options
author | Lars Knoll <lars.knoll@digia.com> | 2014-01-25 21:59:15 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-31 11:13:48 +0100 |
commit | bca28cb0d0dd922ee5d54e5d64d31b97ae5d0266 (patch) | |
tree | 012c4713ce27b1a0a07b5c298a8965127b9f7169 | |
parent | d06cfd6126a23774ba4efe971ed5c8c148822889 (diff) |
Disentangle some includes
ScopedValue should require less dependencies. Hopefully we can then
move it together with the main class definition at some point (ie.
move ScopedValue int qv4value_p.h; similar for the other types).
Change-Id: Ie7b31715cb718a90dba40845c7ae785a29855062
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/jsruntime/qv4context_p.h | 15 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4object_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4scopedvalue_p.h | 20 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4string_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value.cpp | 5 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 3 |
7 files changed, 30 insertions, 22 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index b5c9736725..5904d0b638 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -42,7 +42,7 @@ #define QMLJS_ENVIRONMENT_H #include "qv4global_p.h" -#include "qv4value_p.h" +#include "qv4scopedvalue_p.h" #include "qv4managed_p.h" #include "qv4engine_p.h" @@ -181,6 +181,10 @@ struct CallContext : public ExecutionContext bool needsOwnArguments() const; }; +inline ReturnedValue CallContext::argument(int i) { + return i < callData->argc ? callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue(); +} + struct GlobalContext : public ExecutionContext { GlobalContext(ExecutionEngine *engine); @@ -243,6 +247,15 @@ struct ExecutionContextSaver } }; +inline Scope::Scope(ExecutionContext *ctx) + : engine(ctx->engine) +#ifndef QT_NO_DEBUG + , size(0) +#endif +{ + mark = engine->jsStackTop; +} + /* Function *f, int argc */ #define requiredMemoryForExecutionContect(f, argc) \ sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount)) + sizeof(CallData) diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index 1df388d5b8..3a4cb3d9e7 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -417,9 +417,9 @@ inline ArrayObject *value_cast(const Value &v) { } template<> -inline ReturnedValue value_convert<Object>(ExecutionContext *ctx, const Value &v) +inline ReturnedValue value_convert<Object>(ExecutionEngine *e, const Value &v) { - return v.toObject(ctx)->asReturnedValue(); + return v.toObject(e->currentContext())->asReturnedValue(); } } diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h index a7b21f506a..c64d120cee 100644 --- a/src/qml/jsruntime/qv4runtime_p.h +++ b/src/qml/jsruntime/qv4runtime_p.h @@ -45,6 +45,7 @@ #include "qv4value_inl_p.h" #include "qv4math_p.h" #include "qv4scopedvalue_p.h" +#include "qv4context_p.h" #include <QtCore/QString> #include <QtCore/qnumeric.h> diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index 4338d672f7..3b1f3d5e67 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -41,7 +41,7 @@ #ifndef QV4SCOPEDVALUE_P_H #define QV4SCOPEDVALUE_P_H -#include "qv4context_p.h" +#include "qv4engine_p.h" #include "qv4value_p.h" QT_BEGIN_NAMESPACE @@ -54,15 +54,7 @@ namespace QV4 { struct ScopedValue; struct Scope { - explicit Scope(ExecutionContext *ctx) - : engine(ctx->engine) -#ifndef QT_NO_DEBUG - , size(0) -#endif - { - mark = engine->jsStackTop; - } - + inline explicit Scope(ExecutionContext *ctx); explicit Scope(ExecutionEngine *e) : engine(e) #ifndef QT_NO_DEBUG @@ -234,7 +226,7 @@ struct Scoped Scoped(const Scope &scope, const Value &v, _Convert) { ptr = scope.engine->jsStackTop++; - ptr->val = value_convert<T>(scope.engine->currentContext(), v); + ptr->val = value_convert<T>(scope.engine, v); #ifndef QT_NO_DEBUG ++scope.size; #endif @@ -281,7 +273,7 @@ struct Scoped Scoped(const Scope &scope, const ReturnedValue &v, _Convert) { ptr = scope.engine->jsStackTop++; - ptr->val = value_convert<T>(scope.engine->currentContext(), QV4::Value::fromReturnedValue(v)); + ptr->val = value_convert<T>(scope.engine, QV4::Value::fromReturnedValue(v)); #ifndef QT_NO_DEBUG ++scope.size; #endif @@ -703,10 +695,6 @@ inline WeakValue &WeakValue::operator=(Returned<T> *obj) return operator=(QV4::Value::fromManaged(obj->getPointer()).asReturnedValue()); } -inline ReturnedValue CallContext::argument(int i) { - return i < callData->argc ? callData->args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue(); -} - } diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index e3d8326d84..40f4ff855b 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -186,9 +186,9 @@ inline String *value_cast(const Value &v) { } template<> -inline ReturnedValue value_convert<String>(ExecutionContext *ctx, const Value &v) +inline ReturnedValue value_convert<String>(ExecutionEngine *e, const Value &v) { - return v.toString(ctx)->asReturnedValue(); + return v.toString(e)->asReturnedValue(); } } diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp index 30f7e8cdb0..33084e0499 100644 --- a/src/qml/jsruntime/qv4value.cpp +++ b/src/qml/jsruntime/qv4value.cpp @@ -262,6 +262,11 @@ double Primitive::toInteger(double number) return std::signbit(number) ? -v : v; } +String *Value::toString(ExecutionEngine *e) const +{ + return toString(e->currentContext()); +} + String *Value::toString(ExecutionContext *ctx) const { if (isString()) diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 07757ea1b6..4b5d0de6f9 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -300,6 +300,7 @@ struct Q_QML_EXPORT Value double toNumberImpl() const; QString toQStringNoThrow() const; QString toQString() const; + String *toString(ExecutionEngine *e) const; String *toString(ExecutionContext *ctx) const; Object *toObject(ExecutionContext *ctx) const; @@ -505,7 +506,7 @@ T *value_cast(const Value &v) } template<typename T> -ReturnedValue value_convert(ExecutionContext *ctx, const Value &v); +ReturnedValue value_convert(ExecutionEngine *e, const Value &v); |