QmlJS: Move Context to its own file.

Change-Id: I91331b7039e27e2f57cc19b985c8ed86c955ec9e
Reviewed-on: http://codereview.qt.nokia.com/1042
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
Christian Kamm
2011-07-01 13:51:53 +02:00
parent 9ea0380a4d
commit 36ed6bce1d
23 changed files with 292 additions and 198 deletions

View File

@@ -74,6 +74,7 @@ class AnchorLineValue;
class Imports;
class TypeScope;
class JSImportScope;
class Context;
typedef QList<const Value *> ValueList;
@@ -316,45 +317,6 @@ private:
QList<const ObjectValue *> _all;
};
class QMLJS_EXPORT Context
{
public:
typedef QHash<const Document *, QSharedPointer<const Imports> > ImportsPerDocument;
// Context takes ownership of valueOwner
Context(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports);
~Context();
ValueOwner *valueOwner() const;
Snapshot snapshot() const;
const ScopeChain &scopeChain() const;
ScopeChain &scopeChain();
const Imports *imports(const Document *doc) const;
const Value *lookup(const QString &name, const ObjectValue **foundInScope = 0) const;
const ObjectValue *lookupType(const Document *doc, AST::UiQualifiedId *qmlTypeName,
AST::UiQualifiedId *qmlTypeNameEnd = 0) const;
const ObjectValue *lookupType(const Document *doc, const QStringList &qmlTypeName) const;
const Value *lookupReference(const Value *value) const;
QString defaultPropertyName(const ObjectValue *object) const;
private:
typedef QHash<QString, const Value *> Properties;
Snapshot _snapshot;
QSharedPointer<ValueOwner> _valueOwner;
ImportsPerDocument _imports;
ScopeChain _scopeChain;
int _qmlScopeObjectIndex;
bool _qmlScopeObjectSet;
// for avoiding reference cycles during lookup
mutable QList<const Reference *> _referenceStack;
};
class QMLJS_EXPORT Reference: public Value
{
public: