[Differential] [Updated] D3352: Better unpacking and iteration

brauch (Sven Brauch) noreply at phabricator.kde.org
Sun Nov 13 12:18:35 UTC 2016


brauch added a comment.


  Thank you very much for looking into this and cleaning it up, simply the amount of removed code makes this a very welcome patch already :)
  I added a few small comments, otherwise this looks good to me. Much appreciated!

INLINE COMMENTS

> declarationbuilder.cpp:1232
> +
> +    auto containers = Helper::filterType<AbstractType>(element.type,
> +        [&outTypes, starred](AbstractType::Ptr source) {

I think you shouldn't use this function if you only want to loop over the types. Feel free to add a foreach_unsure_type function or so, or just write out the loop.
`auto containers` is unused (and useless anyways)

> declarationbuilder.cpp:1236
> +                int spare = indexed->typesCount() - outTypes.length();
> +                if ( starred >= 0 ? spare < -1 : spare != 0 ) {
> +                    qWarning() << "Tuple false";

probably more readable with an or

> declarationbuilder.cpp:1237
> +                if ( starred >= 0 ? spare < -1 : spare != 0 ) {
> +                    qWarning() << "Tuple false";
> +                    return false;  // Wrong number of elements to unpack.

make this a qCDebug() with a better message

> helpers.cpp:497
> +            if (auto map = MapType::Ptr::dynamicCast(t)) {
> +                // Iterating over dicts gets keys, not values
> +                return map->keyType().abstractType();

True, good find ;)

REPOSITORY
  rKDEVPYTHON KDev-python

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

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

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


More information about the KDevelop-devel mailing list