Get rid of Environment, introduce external ScopeChain in Link.

Done-with: Roberto
This commit is contained in:
Christian Kamm
2010-02-03 10:59:52 +01:00
parent ba18e70034
commit 49c43aaab1
8 changed files with 96 additions and 144 deletions

View File

@@ -18,15 +18,22 @@ namespace QmlJS {
*/
class QMLJS_EXPORT Link
{
public:
typedef QList<const Interpreter::ObjectValue *> ScopeChain;
public:
// Link all documents in snapshot reachable from doc.
Link(Document::Ptr doc, const Snapshot &snapshot, Interpreter::Engine *interp);
~Link();
Interpreter::Context *context();
ScopeChain scopeChain() const;
Interpreter::Engine *engine();
// Get the scope chain for the currentObject inside doc.
Interpreter::ObjectValue *scopeChainAt(Document::Ptr doc, AST::Node *currentObject);
void scopeChainAt(Document::Ptr doc, AST::Node *currentObject);
const Interpreter::Value *lookup(const QString &name) const;
private:
static QList<Document::Ptr> reachableDocuments(Document::Ptr startDoc, const Snapshot &snapshot);
@@ -48,6 +55,7 @@ private:
Interpreter::Context _context;
QList<Document::Ptr> _docs;
QHash<Document *, Interpreter::ObjectValue *> _typeEnvironments;
ScopeChain _scopeChain;
};
} // namespace QmlJS