aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4scopedvalue_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-12 11:13:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 13:13:47 +0200
commit16f92ad85cf665d863ded5eeaaa7fc3f90820b3f (patch)
tree74b3477b9d6c023730835f1c478ceb6eaec68a2b /src/qml/jsruntime/qv4scopedvalue_p.h
parent7d4e61dd824706984030c58684fa844ff9cde251 (diff)
Convert builtin methods to return a ReturnedValue
Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551 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.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index 0382c7bb4b..68cc2848b3 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -357,6 +357,39 @@ private:
CallData *ptr;
};
+struct Encode : private Value {
+ static ReturnedValue undefined() {
+ return quint64(_Undefined_Type) << Tag_Shift;
+ }
+ static ReturnedValue null() {
+ return quint64(_Null_Type) << Tag_Shift;
+ }
+
+ Encode(bool b) {
+ tag = _Boolean_Type;
+ int_32 = b;
+ }
+ Encode(double d) {
+ dbl = d;
+ }
+ Encode(int i) {
+ tag = _Integer_Type;
+ int_32 = i;
+ }
+ Encode(uint i) {
+ if (i <= INT_MAX) {
+ tag = _Integer_Type;
+ int_32 = i;
+ } else {
+ dbl = i;
+ }
+ }
+
+ operator ReturnedValue() const {
+ return val;
+ }
+};
+
}
QT_END_NAMESPACE