summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-04-21 12:19:02 (GMT)
committerRoberto Raggi <roberto.raggi@nokia.com>2009-04-24 08:05:50 (GMT)
commitc4f351602bb9bc6ea86007115a38b3f2c9ebd6c9 (patch)
tree36f4649d886ca4e7dd9ae58a7b7f12788724b765 /src/declarative/qml
parentaa95c56c618b94cec26315417256bd3a7b327dd9 (diff)
downloadQt-c4f351602bb9bc6ea86007115a38b3f2c9ebd6c9.zip
Qt-c4f351602bb9bc6ea86007115a38b3f2c9ebd6c9.tar.gz
Qt-c4f351602bb9bc6ea86007115a38b3f2c9ebd6c9.tar.bz2
Process the `import' statement.
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp14
-rw-r--r--src/declarative/qml/qmlscriptparser_p.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index 6d49d3f..ffdfdf4 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -72,6 +72,7 @@ protected:
using AST::Visitor::endVisit;
virtual bool visit(AST::UiProgram *node);
+ virtual bool visit(AST::UiImport *node);
virtual bool visit(AST::UiObjectDefinition *node);
virtual bool visit(AST::UiPublicMember *node);
virtual bool visit(AST::UiObjectBinding *node);
@@ -240,6 +241,14 @@ bool ProcessAST::visit(AST::UiProgram *node)
return false;
}
+// UiImport: T_IMPORT T_STRING_LITERAL ;
+bool ProcessAST::visit(AST::UiImport *node)
+{
+ QString fileName = node->fileName->asString();
+ _parser->addNamespacePath(fileName);
+ return false;
+}
+
// UiObjectMember: T_PUBLIC T_IDENTIFIER T_IDENTIFIER T_COLON Expression UiObjectInitializer ;
bool ProcessAST::visit(AST::UiPublicMember *node)
{
@@ -616,5 +625,10 @@ void QmlScriptParser::setTree(Object *tree)
root = tree;
}
+void QmlScriptParser::addNamespacePath(const QString &path)
+{
+ _nameSpacePaths.insertMulti(QString(), path);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlscriptparser_p.h b/src/declarative/qml/qmlscriptparser_p.h
index 6c7c0f1..49128d7 100644
--- a/src/declarative/qml/qmlscriptparser_p.h
+++ b/src/declarative/qml/qmlscriptparser_p.h
@@ -34,6 +34,8 @@ public:
void setScriptFile(const QString &filename) {_scriptFile = filename; }
QString scriptFile() const { return _scriptFile; }
+ void addNamespacePath(const QString &path);
+
private:
QMap<QString,QString> _nameSpacePaths;
QmlParser::Object *root;