Tests pass.
I ran duchainify on a lot of code (all the Python-3.6 source, plus django) with asserts to test that the parameters have no effect:
template<typename T> T* DeclarationBuilder::eventuallyReopenDeclaration(Identifier* name, Ast* range, FitDeclarationType mustFitType)
{
QList<Declaration*> existingDeclarations = existingDeclarationsForNode(name);
-
+ Q_ASSERT(editorFindRange(name, name) == editorFindRange(range, range));
Declaration* dec = nullptr;
reopenFittingDeclaration<T>(existingDeclarations, mustFitType, editorFindRange(range, range), &dec);
bool declarationOpened = (bool) dec;
@@ -233,7 +233,7 @@ template<typename T> T* DeclarationBuilder::visitVariableDeclaration(Identifier*
DUChainWriteLocker lock;
Ast* rangeNode = originalAst ? originalAst : node;
RangeInRevision range = editorFindRange(rangeNode, rangeNode);
-
+ Q_ASSERT(range == editorFindRange(node, node));
// ask the correction file library if there's a user-specified type for this object
if ( AbstractType::Ptr hint = m_correctionHelper->hintForLocal(node->value) ) {
type = hint;
diff --git a/duchain/declarationbuilder.h b/duchain/declarationbuilder.h
index cf54e678..a883d4b7 100644
--- a/duchain/declarationbuilder.h
+++ b/duchain/declarationbuilder.h
@@ -261,6 +261,7 @@ protected:
private:
template<class T> T* openDeclaration(Identifier* name, Ast* range, DeclarationFlags flags = NoFlags)
{
+ Q_ASSERT(name);
T* decl = DeclarationBuilderBase::openDeclaration<T>(name, range, flags);
decl->setAlwaysForceDirect(true);
return decl;