QmlJS: Split Context and ScopeChain.

Context is created by Link and has information about imports
for all Documents in a Snapshot.

ScopeChain represents how lookup is done at a specific place in
a Document.

Change-Id: I874102d57bbaf1a497fa3f27633bed6ee75dcf10
Reviewed-on: http://codereview.qt.nokia.com/1694
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-07-12 14:55:27 +02:00
parent ed1321a4f9
commit f87dc61986
22 changed files with 671 additions and 416 deletions

View File

@@ -34,12 +34,19 @@
#define QMLJSSCOPEBUILDER_H
#include <qmljs/qmljsdocument.h>
#include <qmljs/qmljsinterpreter.h>
#include <QtCore/QList>
namespace QmlJS {
namespace Interpreter {
class QmlComponentChain;
class Context;
class ObjectValue;
class Value;
class ScopeChain;
}
namespace AST {
class Node;
}
@@ -47,11 +54,9 @@ namespace AST {
class QMLJS_EXPORT ScopeBuilder
{
public:
ScopeBuilder(Interpreter::Context *context, Document::Ptr doc);
ScopeBuilder(Interpreter::ScopeChain *scopeChain);
~ScopeBuilder();
void initializeRootScope();
void push(AST::Node *node);
void push(const QList<AST::Node *> &nodes);
void pop();
@@ -59,15 +64,10 @@ public:
static const Interpreter::ObjectValue *isPropertyChangesObject(const Interpreter::Context *context, const Interpreter::ObjectValue *object);
private:
void makeComponentChain(Document::Ptr doc, const Snapshot &snapshot,
Interpreter::ScopeChain::QmlComponentChain *target,
QHash<Document *, Interpreter::ScopeChain::QmlComponentChain *> *components);
void setQmlScopeObject(AST::Node *node);
const Interpreter::Value *scopeObjectLookup(AST::UiQualifiedId *id);
Document::Ptr _doc;
Interpreter::Context *_context;
Interpreter::ScopeChain *_scopeChain;
QList<AST::Node *> _nodes;
};