Skip to content
Snippets Groups Projects
Commit 02ee76b8 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Initalize the members of the binder.

parent 138221ac
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,14 @@ using namespace QmlJS;
using namespace QmlJS::AST;
using namespace QmlJS::Interpreter;
Bind::Bind()
Bind::Bind(Interpreter::Engine *interp)
: _interp(interp),
_interestingMember(0),
_currentObjectValue(0),
_typeEnvironment(0),
_idEnvironment(0),
_interestingObjectValue(0),
_rootObjectValue(0)
{
}
......@@ -43,20 +50,19 @@ Bind::~Bind()
{
}
Interpreter::ObjectValue *Bind::operator()(Document::Ptr doc, Snapshot &snapshot, UiObjectMember *member, Interpreter::Engine &interp)
Interpreter::ObjectValue *Bind::operator()(Document::Ptr doc, const Snapshot &snapshot, UiObjectMember *member)
{
UiProgram *program = doc->qmlProgram();
if (!program)
return 0;
_doc = doc;
_snapshot = &snapshot;
_snapshot = snapshot;
_interestingMember = member;
_interp = &interp;
_currentObjectValue = 0;
_typeEnvironment = _interp->newObject(0);
_idEnvironment = _interp->newObject(0);
_typeEnvironment = _interp->newObject(/*prototype =*/ 0);
_idEnvironment = _interp->newObject(/*prototype =*/ 0);
_interestingObjectValue = 0;
_rootObjectValue = 0;
......
......@@ -39,10 +39,10 @@ namespace QmlJS {
class QMLJS_EXPORT Bind: protected AST::Visitor
{
public:
Bind();
Bind(Interpreter::Engine *interp);
virtual ~Bind();
Interpreter::ObjectValue* operator()(Document::Ptr doc, Snapshot &snapshot, AST::UiObjectMember *member, Interpreter::Engine &interp);
Interpreter::ObjectValue* operator()(Document::Ptr doc, const Snapshot &snapshot, AST::UiObjectMember *member);
protected:
void accept(AST::Node *node);
......@@ -148,9 +148,9 @@ protected:
private:
Document::Ptr _doc;
Snapshot *_snapshot;
AST::UiObjectMember *_interestingMember;
Snapshot _snapshot;
Interpreter::Engine *_interp;
AST::UiObjectMember *_interestingMember;
Interpreter::ObjectValue *_currentObjectValue;
......
......@@ -96,6 +96,7 @@ static QIcon iconForColor(const QColor &color)
}
#if 0
static QString qualifiedNameId(AST::UiQualifiedId *it)
{
QString text;
......@@ -113,7 +114,6 @@ static QString qualifiedNameId(AST::UiQualifiedId *it)
return text;
}
#if 0
static Interpreter::ObjectValue *newComponent(Interpreter::Engine *engine, const QString &name,
const QHash<QString, Document::Ptr> &userComponents,
QSet<QString> *processed)
......@@ -821,8 +821,8 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
scope->setProperty(QLatin1String("parent"), parentItem);
#endif
Bind bind;
scope = bind(qmlDocument, snapshot, declaringMember, interp);
Bind bind(&interp);
scope = bind(qmlDocument, snapshot, declaringMember);
}
// Search for the operator that triggered the completion.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment