Remove some unneeded parameters
ClosedPublic

Authored by flherne on Sep 1 2017, 2:30 PM.

Details

Reviewers
brauch
Summary

Since https://cgit.kde.org/kdev-python.git/commit/?h=5.2&id=b553d75e , none of these range-overriding parameters have an effect (some weren't used before either).

This also fixes a deprecation warning by not using the QualifiedIdentifier overload of openDeclaration().

Test Plan

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;

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
flherne created this revision.Sep 1 2017, 2:30 PM
Restricted Application added a subscriber: kdevelop-devel. ยท View Herald TranscriptSep 1 2017, 2:30 PM
flherne edited the test plan for this revision. (Show Details)Sep 1 2017, 2:31 PM
brauch accepted this revision.Sep 1 2017, 3:28 PM

Looks good, thanks!

This revision is now accepted and ready to land.Sep 1 2017, 3:28 PM

I did some more testing and it crashed...not sure why yet :-/