Remove decorator declarations
ClosedPublic

Authored by flherne on Jan 18 2017, 9:41 AM.

Details

Reviewers
brauch
Summary

These seem to have been used for the builtin documentation before the current docstring solution. Currently we do nothing with decorators except a few hardcoded ones, and this declaration system is needlessly complicated.

Also fixes a bug - decorator declarations were never *removed* from a function, so removing a decorator would have no effect until renaming or moving the function.

The new isProperty() thing should be replaced by real property types/declarations at some point.

Test Plan

Tested that the effects of decorators now go away when they're edited out.

Removes the decorator duchaintests, because they don't make sense without decorator declarations. The visible behaviour we actually implement (static/classmethods) is already included in several other tests.

No known regressions.

Diff Detail

Repository
R53 KDevelop: Python Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
flherne updated this revision to Diff 10310.Jan 18 2017, 9:41 AM
flherne retitled this revision from to Remove decorator declarations.
flherne updated this object.
flherne edited the test plan for this revision. (Show Details)
flherne added a reviewer: brauch.
flherne set the repository for this revision to R53 KDevelop: Python Support.
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJan 18 2017, 9:41 AM

Hmm, not sure. Don't you think it's useful to have decoratos attached to the functions? We could, for example, list them in the navigation popup -- wouldn't that be useful?
We can certainly remove this "additional information" stuff, though, that's right.

flherne updated this revision to Diff 11846.Feb 26 2017, 11:04 AM
flherne edited the summary of this revision. (Show Details)
flherne edited the test plan for this revision. (Show Details)

Added an 'isProperty' flag to FunctionDeclaration to avoid regressing for the moment. (in fact it should be slightly better, because it understands @foo.getter).

Left Python::ClassDeclaration in as a stub - without the decorator decls, it now doesn't have anything, but as you say it would make sense to store strings or something similar for use in the tooltips.

LGTM except what I noted above (no need to resubmit).
Should we remove the custom data class maybe, now that it does nothing any more ...?

duchain/declarationbuilder.cpp
1499

Can we have this as the default initialized values instead?

flherne marked an inline comment as done.Feb 26 2017, 9:29 PM
flherne added inline comments.
duchain/declarationbuilder.cpp
1499

No, because then when you remove the decorator the effect doesn't go away. That problem was why I started looking at this in the first place.

brauch accepted this revision.Feb 26 2017, 10:24 PM
This revision is now accepted and ready to land.Feb 26 2017, 10:24 PM