Commit f3f8ed83 authored by Denis Steckelmacher's avatar Denis Steckelmacher

Ensure that getDeclaration and the code-completion can find declarations...

Ensure that getDeclaration and the code-completion can find declarations independently of their position in a QML file

QML and Javascript are highly dynamic languages and most of their declarations
can be used before the declaration itself. Now that the parser does two parsing
passes, this commit ensures that the location of an use is completely ignored
and that the parser always sees the complete list of declarations in a context.
parent 4f9fcba5
......@@ -102,7 +102,7 @@ QList<CompletionTreeItemPointer> CodeCompletionContext::completionsInContext(con
if (context) {
const QList<DeclarationDepthPair>& declarations = context->allDeclarations(
context == m_duContext ? m_position : CursorInRevision::invalid(),
CursorInRevision::invalid(),
context->topContext(),
!onlyLocal
);
......
......@@ -33,7 +33,7 @@ DeclarationPointer getDeclaration(const QualifiedIdentifier& id, const DUContext
{
DUChainReadLocker lock;
if (context) {
foreach (Declaration* dec, context->findDeclarations(id)) {
foreach (Declaration* dec, context->findDeclarations(id, CursorInRevision(INT_MAX, INT_MAX))) {
return DeclarationPointer(dec);
}
}
......
......@@ -3,16 +3,6 @@
* "kind" : "Namespace"
*/
Module {
Component {
name: "QModelIndex"
/**
* "toString" : "int childCount",
* "useCount" : 2
*/
Property { name: "childCount"; type: "int" }
}
/**
* "toString" : "interface QAbstractItemModel",
* "kind": "Type",
......@@ -83,6 +73,16 @@ Module {
}
}
Component {
name: "QModelIndex"
/**
* "toString" : "int childCount",
* "useCount" : 2
*/
Property { name: "childCount"; type: "int" }
}
/**
* "kind" : "Type"
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment