diff options
author | Christian Kamm <[email protected]> | 2010-09-16 15:29:37 +0200 |
---|---|---|
committer | Christian Kamm <[email protected]> | 2010-09-16 15:51:21 +0200 |
commit | c7b3e3c81c760bce7a15964a1b583b344e0db1b4 (patch) | |
tree | bd2f0d2ed1b3e91c7797d43dba6d336bdda250bc /src/libs/qmljs/qmljsbind.h | |
parent | 97c07292aa661754470d71af0774f247275cb9cb (diff) |
QmlJS: Speed up Link significantly, provide more info on imports.
Link now caches imports. That means importing the same library (say, Qt)
from more than one file no longer creates an importing namespace for
each one. Instead, a single one is created for the instance of Link.
To make this work, the type environment in ScopeChain has been given its
own type: Interpreter::TypeEnvironment. That has the added benefit of
being able to carry meta-information about imports. You can use
TypeEnvironment::importInfo(qmlComponentName) to get information about
the import node that caused the import of the component.
Diffstat (limited to 'src/libs/qmljs/qmljsbind.h')
-rw-r--r-- | src/libs/qmljs/qmljsbind.h | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/libs/qmljs/qmljsbind.h b/src/libs/qmljs/qmljsbind.h index ddbfa5b1df3..b5e779616b6 100644 --- a/src/libs/qmljs/qmljsbind.h +++ b/src/libs/qmljs/qmljsbind.h @@ -37,6 +37,7 @@ #include <QtCore/QHash> #include <QtCore/QStringList> #include <QtCore/QSharedPointer> +#include <QtCore/QCoreApplication> namespace QmlJS { @@ -46,28 +47,13 @@ class Document; class QMLJS_EXPORT Bind: protected AST::Visitor { Q_DISABLE_COPY(Bind) + Q_DECLARE_TR_FUNCTIONS(QmlJS::Bind) public: - Bind(Document *doc); + Bind(Document *doc, QList<DiagnosticMessage> *messages); virtual ~Bind(); - struct ImportInfo { - enum Type { - LibraryImport, - FileImport, - DirectoryImport, - InvalidFileImport // refers a file/directoy that wasn't found - }; - - Type type; - // LibraryImport: uri with '/' separator - // Other: absoluteFilePath - QString name; - ComponentVersion version; - AST::UiImport *ast; - }; - - QList<ImportInfo> imports() const; + QList<Interpreter::ImportInfo> imports() const; Interpreter::ObjectValue *idEnvironment() const; Interpreter::ObjectValue *rootObjectValue() const; @@ -119,7 +105,9 @@ private: QHash<AST::FunctionDeclaration *, Interpreter::ObjectValue *> _functionScopes; QStringList _includedScripts; - QList<ImportInfo> _imports; + QList<Interpreter::ImportInfo> _imports; + + QList<DiagnosticMessage> *_diagnosticMessages; }; } // end of namespace Qml |