aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qmljs/qmljslink.h
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2010-09-16 15:29:37 +0200
committerChristian Kamm <christian.d.kamm@nokia.com>2010-09-16 15:51:21 +0200
commitc7b3e3c81c760bce7a15964a1b583b344e0db1b4 (patch)
treebd2f0d2ed1b3e91c7797d43dba6d336bdda250bc /src/libs/qmljs/qmljslink.h
parent97c07292aa661754470d71af0774f247275cb9cb (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/qmljslink.h')
-rw-r--r--src/libs/qmljs/qmljslink.h17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/libs/qmljs/qmljslink.h b/src/libs/qmljs/qmljslink.h
index 54e85446aa..d81fcc509a 100644
--- a/src/libs/qmljs/qmljslink.h
+++ b/src/libs/qmljs/qmljslink.h
@@ -42,12 +42,14 @@
namespace QmlJS {
class NameId;
+class LinkPrivate;
/*
Helper for building a context.
*/
class QMLJS_EXPORT Link
{
+ Q_DECLARE_PRIVATE(Link)
Q_DECLARE_TR_FUNCTIONS(QmlJS::Link)
public:
@@ -73,22 +75,15 @@ private:
void linkImports();
void initializeScopeChain();
- void populateImportedTypes(Interpreter::ObjectValue *typeEnv, Document::Ptr doc);
- void importFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc,
- AST::UiImport *import);
- void importNonFile(Interpreter::ObjectValue *typeEnv, Document::Ptr doc,
- AST::UiImport *import);
+ void populateImportedTypes(Interpreter::TypeEnvironment *typeEnv, Document::Ptr doc);
+ Interpreter::ObjectValue *importFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo);
+ Interpreter::ObjectValue *importNonFile(Document::Ptr doc, const Interpreter::ImportInfo &importInfo);
void importObject(Bind *bind, const QString &name, Interpreter::ObjectValue *object, NameId *targetNamespace);
void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
private:
- Document::Ptr _doc;
- Snapshot _snapshot;
- Interpreter::Context *_context;
- const QStringList _importPaths;
-
- QList<DiagnosticMessage> _diagnosticMessages;
+ QScopedPointer<LinkPrivate> d_ptr;
};
} // namespace QmlJS