summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-13 02:26:30 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-13 02:26:45 (GMT)
commit57e0665cb997046389066bd2d2b26a30c367ece8 (patch)
treee73b0bc85608a8bd902bc682beece9659d1c2fe7 /src
parentc87665193a9198168e6e42978833ce6c96ae184d (diff)
downloadQt-57e0665cb997046389066bd2d2b26a30c367ece8.zip
Qt-57e0665cb997046389066bd2d2b26a30c367ece8.tar.gz
Qt-57e0665cb997046389066bd2d2b26a30c367ece8.tar.bz2
Fix qmlparser test failure
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qmlparser.cpp9
-rw-r--r--src/declarative/qml/qmlparser_p.h3
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp4
3 files changed, 10 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp
index 10eec61..c5d7092 100644
--- a/src/declarative/qml/qmlparser.cpp
+++ b/src/declarative/qml/qmlparser.cpp
@@ -276,8 +276,8 @@ QmlParser::Variant::Variant(bool v)
{
}
-QmlParser::Variant::Variant(double v)
-: t(Number), d(v)
+QmlParser::Variant::Variant(double v, const QString &asWritten)
+: t(Number), d(v), s(asWritten)
{
}
@@ -324,7 +324,10 @@ QString QmlParser::Variant::asScript() const
case Boolean:
return b?QLatin1String("true"):QLatin1String("false");
case Number:
- return QString::number(d);
+ if (s.isEmpty())
+ return QString::number(d);
+ else
+ return s;
case String:
case Script:
return s;
diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h
index a6894fb..d4f279b 100644
--- a/src/declarative/qml/qmlparser_p.h
+++ b/src/declarative/qml/qmlparser_p.h
@@ -44,6 +44,7 @@
#include <QByteArray>
#include <QList>
+#include <QtCore/qstring.h>
#include <qml.h>
#include <private/qmlrefcount_p.h>
#include <private/qobject_p.h>
@@ -173,7 +174,7 @@ namespace QmlParser
Variant();
Variant(const Variant &);
Variant(bool);
- Variant(double);
+ Variant(double, const QString &asWritten=QString());
Variant(const QString &, Type = String);
Variant &operator=(const Variant &);
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index ae4e903..ff19d25 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -488,12 +488,12 @@ QmlParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr)
} else if (expr->kind == AST::Node::Kind_FalseLiteral) {
return QmlParser::Variant(false);
} else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr)) {
- return QmlParser::Variant(lit->value);
+ return QmlParser::Variant(lit->value, asString(expr));
} else {
if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(unaryMinus->expression)) {
- return QmlParser::Variant(-lit->value);
+ return QmlParser::Variant(-lit->value, asString(expr));
}
}