diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-29 12:14:53 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-06-04 13:02:09 +0000 |
commit | 8e23235181eb25faf99324e136412da23dc8386f (patch) | |
tree | 97071ffe480c175200e8cb765a80015aa11cf890 /src/qml/jsruntime/qv4mathobject.cpp | |
parent | a0fcf724ef1d8586301a913d2cd744aed33e3605 (diff) |
Use Symbol.toStringTag in Object.prototype.toString
This should make toString comply fully with the JS Spec.
Also add a couple of missing Symbol.toStringTag
properties.
Change-Id: I29e2018b486a0e1d174b58ce7a14f0e42cc78767
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4mathobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4mathobject.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp index 43459211f6..0e91a30ba3 100644 --- a/src/qml/jsruntime/qv4mathobject.cpp +++ b/src/qml/jsruntime/qv4mathobject.cpp @@ -39,6 +39,7 @@ #include "qv4mathobject_p.h" #include "qv4objectproto_p.h" +#include "qv4symbol_p.h" #include <QtCore/qdatetime.h> #include <QtCore/qmath.h> @@ -90,6 +91,9 @@ void Heap::MathObject::init() m->defineDefaultProperty(QStringLiteral("sin"), QV4::MathObject::method_sin, 1); m->defineDefaultProperty(QStringLiteral("sqrt"), QV4::MathObject::method_sqrt, 1); m->defineDefaultProperty(QStringLiteral("tan"), QV4::MathObject::method_tan, 1); + + ScopedString name(scope, scope.engine->newString(QStringLiteral("Math"))); + m->defineReadonlyConfigurableProperty(scope.engine->symbol_toStringTag(), name); } static Q_ALWAYS_INLINE double copySign(double x, double y) |