Bind each QML document after parsing. Link them before use.

Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Christian Kamm
2010-02-02 15:55:17 +01:00
parent e7a330f92a
commit 03fa188b41
8 changed files with 321 additions and 315 deletions

View File

@@ -31,11 +31,12 @@
#define QMLBIND_H
#include <qmljs/parser/qmljsastvisitor_p.h>
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/qmljsdocument.h>
#include <QtCore/QHash>
#include <QtCore/QStringList>
#include <QtCore/QSharedPointer>
namespace QmlJS {
@@ -44,21 +45,13 @@ class Link;
class QMLJS_EXPORT Bind: protected AST::Visitor
{
protected:
Bind(Document::Ptr doc, Interpreter::Engine *interp);
public:
Bind(Document *doc);
virtual ~Bind();
QStringList includedScripts() const;
QStringList localImports() const;
// ### TODO: This methods should go. Bind each document after parsing, link later.
static Interpreter::ObjectValue *scopeChainAt(Document::Ptr currentDocument,
const Snapshot &snapshot,
Interpreter::Engine *interp,
AST::UiObjectMember *currentObject);
protected:
using AST::Visitor::visit;
@@ -83,11 +76,10 @@ protected:
Interpreter::ObjectValue *bindObject(AST::UiQualifiedId *qualifiedTypeNameId, AST::UiObjectInitializer *initializer);
private:
Document::Ptr _doc;
Interpreter::Engine *_interp;
Document *_doc;
Interpreter::Engine _interp;
Interpreter::ObjectValue *_currentObjectValue;
Interpreter::ObjectValue *_typeEnvironment;
Interpreter::ObjectValue *_idEnvironment;
Interpreter::ObjectValue *_functionEnvironment;
Interpreter::ObjectValue *_rootObjectValue;
@@ -100,6 +92,7 @@ private:
friend class LinkImports;
friend class Link;
};
typedef QSharedPointer<Bind> BindPtr;
} // end of namespace Qml