Improve building of the Qml/JS scope chain.

* For JS files: Add each Qml component that sources the file in a Script
  tag to the scope chain.
* For Qml components: Add each component that instantiates the component
  to the scope chain.
* Generate the full list of documents required for completion in a
  given file. Previously, files that included the file were missing.
This commit is contained in:
Christian Kamm
2010-02-11 18:58:17 +01:00
parent 62dd493865
commit 2b1adbf610
4 changed files with 134 additions and 41 deletions

View File

@@ -92,6 +92,19 @@ Interpreter::ObjectValue *Bind::findQmlObject(AST::Node *node) const
return _qmlObjects.value(node);
}
bool Bind::usesQmlPrototype(ObjectValue *prototype,
Context *context) const
{
foreach (ObjectValue *object, _qmlObjects.values()) {
const ObjectValue *resolvedPrototype = object->prototype(context);
if (resolvedPrototype == prototype)
return true;
}
return false;
}
ObjectValue *Bind::switchObjectValue(ObjectValue *newObjectValue)
{
ObjectValue *oldObjectValue = _currentObjectValue;
@@ -195,8 +208,8 @@ bool Bind::visit(AST::UiProgram *)
bool Bind::visit(AST::Program *)
{
_currentObjectValue = _engine.globalObject();
_rootObjectValue = _engine.globalObject();
_currentObjectValue = _engine.newObject(/*prototype =*/ 0);
_rootObjectValue = _currentObjectValue;
return true;
}