summaryrefslogtreecommitdiff
path: root/tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-11-23 19:00:29 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-12-03 12:09:26 +0100
commit58ff7aa4fed5b3a27b6a859fc02f9ee27dd1a6cc (patch)
treecd8d455066d5e9e6d14988e945f4ba421765b743 /tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml
parentc2f50cf90d143d96313ab3cfdbb9e4552a095cbb (diff)
downloadqtdeclarative-58ff7aa4fed5b3a27b6a859fc02f9ee27dd1a6cc.tar.gz
Compile QML files ahead of time with qmlcachegen
qmlcachegen compiles bindings and functions to C++ as far as QQmlJSAotCompiler can. It does respect "pragma Strict" and rejects the file if it's violated. Furthermore, it sets up the logger to follow the qt.qml.compiler.aot logging category. By default it's completely silent. Compiling the examples with qmlcachegen exposes a bug in the type resolver where it returns an invalid generic type. It should never do that. Fix it by returning JSValue. [ChangeLog][QtQml][Important Behavior Changes] QML bindings and functions are now compiled to C++ by qmlcachegen, if possible. Use the qt.qml.compiler.aot logging category to receive diagnostics about the compilation. Task-number: QTBUG-98305 Change-Id: I6953812c3fd20b68339617a5714fcbe16a384360 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml')
-rw-r--r--tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml b/tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml
new file mode 100644
index 0000000000..795e38b652
--- /dev/null
+++ b/tests/auto/qml/qmlcppcodegen/data/jsMathObject.qml
@@ -0,0 +1,64 @@
+/******************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt JavaScript to C++ compiler.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** $QT_END_LICENSE$
+**
+******************************************************************************/
+
+pragma Strict
+import QtQml
+
+QtObject {
+ property double a: 0
+ property double b: 0
+
+ property double abs: Math.abs(a)
+ property double acos: Math.acos(a)
+ property double acosh: Math.acosh(a)
+ property double asin: Math.asin(a)
+ property double asinh: Math.asinh(a)
+ property double atan: Math.atan(a)
+ property double atanh: Math.atanh(a)
+// property double atan2: Math.atan2(a)
+ property double cbrt: Math.cbrt(a)
+ property double ceil: Math.ceil(a)
+ property double clz32: Math.clz32(a)
+ property double cos: Math.cos(a)
+ property double cosh: Math.cosh(a)
+ property double exp: Math.exp(a)
+// property double expm1: Math.expm1(a)
+ property double floor: Math.floor(a)
+ property double fround: Math.fround(a)
+// property double hypot: Math.hypot(a)
+ property double imul: Math.imul(a, b)
+ property double log: Math.log(a)
+ property double log10: Math.log10(a)
+ property double log1p: Math.log1p(a)
+ property double log2: Math.log2(a)
+ property double max: Math.max(a, b)
+ property double min: Math.min(a, b)
+// property double pow: Math.pow(a, b)
+ property double random: Math.random()
+ property double round: Math.round(a)
+ property double sign: Math.sign(a)
+ property double sin: Math.sin(a)
+ property double sinh: Math.sinh(a)
+ property double sqrt: Math.sqrt(a)
+ property double tan: Math.tan(a)
+ property double tanh: Math.tanh(a)
+ property double trunc: Math.trunc(a)
+}