summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlscriptparser.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-05-26 08:33:39 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-05-26 08:42:11 (GMT)
commitba2f5f0c0d0ae594e391e95f7b05d0d29348e1e5 (patch)
treea9e51d7ae05c7054ea98483f1e09447aa4f05689 /src/declarative/qml/qmlscriptparser.cpp
parentaedd4d0cfb6965f51fb38689539b3417b6071601 (diff)
downloadQt-ba2f5f0c0d0ae594e391e95f7b05d0d29348e1e5.zip
Qt-ba2f5f0c0d0ae594e391e95f7b05d0d29348e1e5.tar.gz
Qt-ba2f5f0c0d0ae594e391e95f7b05d0d29348e1e5.tar.bz2
Create a new TextWriter when rewriting the CSS literals.
Diffstat (limited to 'src/declarative/qml/qmlscriptparser.cpp')
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index fde2771..b99f0ff 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -1,4 +1,3 @@
-
#include "qmlscriptparser_p.h"
#include "qmlparser_p.h"
@@ -27,16 +26,18 @@ namespace {
class RewriteNumericLiterals: protected AST::Visitor
{
unsigned _position;
- TextWriter _writer;
+ TextWriter *_writer;
public:
QString operator()(QString code, unsigned position, AST::Node *node)
{
+ TextWriter w;
+ _writer = &w;
_position = position;
AST::Node::acceptChild(node, this);
- _writer.write(&code);
+ w.write(&code);
return code;
}
@@ -54,10 +55,10 @@ protected:
pre += QChar(QLatin1Char(suffixSpell[0])).toUpper();
pre += QLatin1String(&suffixSpell[1]);
pre += QLatin1Char('(');
- _writer.replace(node->literalToken.begin() - _position, 0, pre);
- _writer.replace(node->literalToken.end() - _position - suffixLength,
- suffixLength,
- QLatin1String(")"));
+ _writer->replace(node->literalToken.begin() - _position, 0, pre);
+ _writer->replace(node->literalToken.end() - _position - suffixLength,
+ suffixLength,
+ QLatin1String(")"));
}
return false;