aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4scopedvalue_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-05-08 14:35:30 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-22 13:49:14 +0200
commite8746aeaecc4b1cfe312d8ed943ad74bd53f66e2 (patch)
treef4f391707da4054502b4826eedec5cc80bfe0a1c /src/qml/jsruntime/qv4scopedvalue_p.h
parent0732e0177e62590c812f0fea9c32f7d427bd933f (diff)
Start implement new Object creation pattern
Create objects through a static create() method that returns a pointer to the objects Data. This will later on simplify breaking the direct connection between Object and Object::Data. Change-Id: Id8daa3c766429bc36f432868e1957846147c96b6 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4scopedvalue_p.h')
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index dfaa7e68bc..5a7852f49b 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -215,6 +215,16 @@ struct Scoped
++scope.size;
#endif
}
+ Scoped(const Scope &scope, HeapObject *o)
+ {
+ Value v;
+ v.m = reinterpret_cast<Managed *>(o);
+ ptr = scope.engine->jsStackTop++;
+ setPointer(value_cast<T>(v));
+#ifndef QT_NO_DEBUG
+ ++scope.size;
+#endif
+ }
Scoped(const Scope &scope, const ScopedValue &v)
{
ptr = scope.engine->jsStackTop++;
@@ -280,6 +290,12 @@ struct Scoped
#endif
}
+ Scoped<T> &operator=(HeapObject *o) {
+ Value v;
+ v.m = reinterpret_cast<Managed *>(o);
+ setPointer(value_cast<T>(v));
+ return *this;
+ }
Scoped<T> &operator=(const Value &v) {
setPointer(value_cast<T>(v));
return *this;