D7643: Remove some unneeded parameters

Francis Herne noreply at phabricator.kde.org
Fri Sep 1 14:31:52 UTC 2017


flherne created this revision.
Restricted Application added a subscriber: kdevelop-devel.

REVISION 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;

REPOSITORY
  R53 KDevelop: Python Support

REVISION DETAIL
  https://phabricator.kde.org/D7643

AFFECTED FILES
  duchain/declarationbuilder.cpp
  duchain/declarationbuilder.h

To: flherne, brauch
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20170901/da359eba/attachment.html>


More information about the KDevelop-devel mailing list