aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
-rw-r--r--src/qml/compiler/qv4codegen.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp
index f5cce4fdba..74c462d70d 100644
--- a/src/qml/compiler/qv4codegen.cpp
+++ b/src/qml/compiler/qv4codegen.cpp
@@ -1577,6 +1577,33 @@ IR::Expr *Codegen::identifier(const QString &name, int line, int col)
}
+Moth::Param Codegen::paramForNull()
+{
+ return paramForConst(QV4::Encode::null());
+}
+
+Moth::Param Codegen::paramForUndefined()
+{
+ return paramForConst(QV4::Encode::undefined());
+}
+
+Moth::Param Codegen::paramForBool(bool b)
+{
+ return paramForConst(QV4::Encode(b));
+}
+
+Moth::Param Codegen::paramForNumber(double d)
+{
+ // ### specialize for integers
+ return paramForConst(QV4::Encode(d));
+}
+
+Moth::Param Codegen::paramForConst(QV4::ReturnedValue v)
+{
+ int idx = jsUnitGenerator->registerConstant(v);
+ return Moth::Param::createConstant(idx);
+}
+
Moth::Param Codegen::paramForName(const QString &name, bool isLhs)
{
uint scope = 0;