diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-27 06:03:25 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-27 06:03:25 (GMT) |
commit | 0a6df63c7150f0010b08ce2ba08a492cd129a96f (patch) | |
tree | f36c41c6b8665e761ae933393785b7d5f8481258 /src/declarative/qml/qmlparser.cpp | |
parent | a190b92bb4eb40ecf8c30d6f368c0d15ec317580 (diff) | |
download | Qt-0a6df63c7150f0010b08ce2ba08a492cd129a96f.zip Qt-0a6df63c7150f0010b08ce2ba08a492cd129a96f.tar.gz Qt-0a6df63c7150f0010b08ce2ba08a492cd129a96f.tar.bz2 |
Save the JavaScript AST in the QmlParser::Variant for use by others
Diffstat (limited to 'src/declarative/qml/qmlparser.cpp')
-rw-r--r-- | src/declarative/qml/qmlparser.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlparser.cpp b/src/declarative/qml/qmlparser.cpp index c5d7092..5c2a69f 100644 --- a/src/declarative/qml/qmlparser.cpp +++ b/src/declarative/qml/qmlparser.cpp @@ -281,10 +281,14 @@ QmlParser::Variant::Variant(double v, const QString &asWritten) { } -QmlParser::Variant::Variant(const QString &v, Type type) -: t(type), s(v) +QmlParser::Variant::Variant(const QString &v) +: t(String), s(v) +{ +} + +QmlParser::Variant::Variant(const QString &v, JavaScript::AST::Node *n) +: t(Script), n(n), s(v) { - Q_ASSERT(type == String || type == Script); } QmlParser::Variant &QmlParser::Variant::operator=(const Variant &o) @@ -334,4 +338,12 @@ QString QmlParser::Variant::asScript() const } } +JavaScript::AST::Node *QmlParser::Variant::asAST() const +{ + if (type() == Script) + return n; + else + return 0; +} + QT_END_NAMESPACE |