diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-02-13 09:30:11 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2015-03-20 11:16:59 +0000 |
commit | 4e3fef5528587c3a360c7e8057ad8d9328f9e4cc (patch) | |
tree | fb21b2bbbc8b16fd3ebcc69be0e46d5f2c9a202c /src | |
parent | 6e3b0d3aceb58a1cddc0defd7128bf1e23312893 (diff) |
Get rid of Value::fromManaged()
Change-Id: Ifb889e4b270dee8350a9c8f7559c671413995e4b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 7 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4property_p.h | 8 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_p.h | 9 |
3 files changed, 10 insertions, 14 deletions
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index ac7d06ab2f..5a4f305ef3 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -257,13 +257,6 @@ inline FunctionObject *managed_cast(Managed *m) return m ? m->asFunctionObject() : 0; } -inline Value Value::fromManaged(Managed *m) -{ - if (!m) - return QV4::Primitive::undefinedValue(); - return *m; -} - } diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h index 94167ca8f0..34d9cdadeb 100644 --- a/src/qml/jsruntime/qv4property_p.h +++ b/src/qml/jsruntime/qv4property_p.h @@ -72,8 +72,8 @@ struct Property { inline Heap::FunctionObject *getter() const { return value.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(value.heapObject()) : 0; } inline Heap::FunctionObject *setter() const { return set.isManaged() ? reinterpret_cast<Heap::FunctionObject *>(set.heapObject()) : 0; } - inline void setGetter(FunctionObject *g) { value = Primitive::fromManaged(reinterpret_cast<Managed *>(g)); } - inline void setSetter(FunctionObject *s) { set = s ? Primitive::fromManaged(reinterpret_cast<Managed *>(s)) : Value::fromHeapObject(0); } + inline void setGetter(FunctionObject *g) { value = reinterpret_cast<Managed *>(g); } + inline void setSetter(FunctionObject *s) { set = (s ? reinterpret_cast<Managed *>(s) : 0); } void copy(const Property *other, PropertyAttributes attrs) { value = other->value; @@ -84,8 +84,8 @@ struct Property { explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); } explicit Property(Value v) : value(v) { set = Value::fromHeapObject(0); } Property(FunctionObject *getter, FunctionObject *setter) { - value = Primitive::fromManaged(reinterpret_cast<Managed *>(getter)); - set = Primitive::fromManaged(reinterpret_cast<Managed *>(setter)); + value = reinterpret_cast<Managed *>(getter); + set = reinterpret_cast<Managed *>(setter); } Property(Heap::FunctionObject *getter, Heap::FunctionObject *setter) { value.m = reinterpret_cast<Heap::Base *>(getter); diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 194b0ececc..71ffae4f0a 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -282,8 +282,6 @@ struct Q_QML_PRIVATE_EXPORT Value return v; } - static inline Value fromManaged(Managed *m); - int toUInt16() const; inline int toInt32() const; inline unsigned int toUInt32() const; @@ -337,7 +335,12 @@ struct Q_QML_PRIVATE_EXPORT Value Value &operator =(const ScopedValue &v); Value &operator=(ReturnedValue v) { val = v; return *this; } Value &operator=(Managed *m) { - val = Value::fromManaged(m).val; + if (!m) { + tag = Undefined_Type; + uint_32 = 0; + } else { + val = reinterpret_cast<Value *>(m)->val; + } return *this; } Value &operator=(Heap::Base *o) { |