summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlscriptparser_p.h
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-08-21 11:15:28 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-08-21 11:22:34 (GMT)
commitbf04e19750502ea6346eb6eac08a6370b11dd0e3 (patch)
treedc3e097c6e82041438a90f1f429e6ecfae9efca1 /src/declarative/qml/qmlscriptparser_p.h
parent715056fe9939452c0223f5d8ff217bed3b8015de (diff)
downloadQt-bf04e19750502ea6346eb6eac08a6370b11dd0e3.zip
Qt-bf04e19750502ea6346eb6eac08a6370b11dd0e3.tar.gz
Qt-bf04e19750502ea6346eb6eac08a6370b11dd0e3.tar.bz2
Store location information for "Type XXX is not available" messages
QmlScriptParser now also stores the locations where a specific type was referenced.
Diffstat (limited to 'src/declarative/qml/qmlscriptparser_p.h')
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
index 355ff75..d489610 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -84,12 +84,24 @@ public:
QmlParser::LocationSpan location;
};
+ class TypeReference
+ {
+ public:
+ TypeReference(int typeId, const QString &typeName) : id(typeId), name(typeName) {}
+
+ int id;
+ // type as it has been referenced in Qml
+ QString name;
+ // objects in parse tree referencing the type
+ QList<QmlParser::Object*> refObjects;
+ };
+
QmlScriptParser();
~QmlScriptParser();
bool parse(const QByteArray &data, const QUrl &url = QUrl());
- QStringList types() const;
+ QList<TypeReference*> referencedTypes() const;
QmlParser::Object *tree() const;
QList<Import> imports() const;
@@ -99,7 +111,7 @@ public:
QList<QmlError> errors() const;
// ### private:
- int findOrCreateTypeId(const QString &name);
+ TypeReference *findOrCreateType(const QString &name);
void setTree(QmlParser::Object *tree);
void setScriptFile(const QString &filename) {_scriptFile = filename; }
@@ -110,7 +122,7 @@ public:
QmlParser::Object *root;
QList<Import> _imports;
- QStringList _typeNames;
+ QList<TypeReference*> _refTypes;
QString _scriptFile;
QmlScriptParserJsASTData *data;
};