aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-07-14 01:02:04 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-16 09:38:30 +0200
commit43645fd59c6bcb0a3e37eef530ef970f51ed48af (patch)
treed377a19c36e9e853377db59b58d937db0ea67e0d /src/qml/parser
parentad0f200df54e5afcb1fdcb977794259bdb9216b5 (diff)
parentf42207cbdb0cbe5e345bfd9e000b3e77b34a503c (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/quick/items/qquickloader.cpp tests/auto/quick/qquickanimations/tst_qquickanimations.cpp Change-Id: I0cb9f637d24ccd0ecfb50c455cc210119f744b02
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljsast.cpp22
-rw-r--r--src/qml/parser/qqmljsast_p.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index b8c4a58a13..d254279cbf 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -503,6 +503,28 @@ void NumericLiteralPropertyName::accept0(Visitor *visitor)
visitor->endVisit(this);
}
+namespace {
+struct LocaleWithoutZeroPadding : public QLocale
+{
+ LocaleWithoutZeroPadding()
+ : QLocale(QLocale::C)
+ {
+ setNumberOptions(QLocale::OmitLeadingZeroInExponent | QLocale::OmitGroupSeparator);
+ }
+};
+}
+
+QString NumericLiteralPropertyName::asString()const
+{
+ // Can't use QString::number here anymore as it does zero padding by default now.
+
+ // In C++11 this initialization is thread-safe (6.7 [stmt.dcl] p4)
+ static LocaleWithoutZeroPadding locale;
+ // Because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 we can't use thread_local
+ // for the locale variable and therefore rely on toString(double) to be thread-safe.
+ return locale.toString(id, 'g', 16);
+}
+
void ArrayMemberExpression::accept0(Visitor *visitor)
{
if (visitor->visit(this)) {
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h
index 2cf2bcb736..07999404b4 100644
--- a/src/qml/parser/qqmljsast_p.h
+++ b/src/qml/parser/qqmljsast_p.h
@@ -870,7 +870,7 @@ public:
void accept0(Visitor *visitor) override;
- QString asString() const override { return QString::number(id, 'g', 16); }
+ QString asString() const override;
// attributes
double id;