Review Request 118325: Move all the code creating contexts from ContextBuilder to DeclarationBuilder

Denis Steckelmacher steckdenis at yahoo.fr
Mon May 26 09:52:15 UTC 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118325/
-----------------------------------------------------------

Review request for KDevelop.


Repository: kdev-qmljs


Description
-------

After having discussed with Sven Brauch on IRC, we decided to test if merging the features of ContextBuilder in DeclarationBuilder is possible. The potential benefit of that is the simplification of the code logic: contexts are created right after their corresponding declarations, and a quick look a the source code immediately exposes what is created where, why does this particular structure have a dedicated context, etc.

The closer integration of contexts and declarations also allows some code simplifications (currently not many, but future features will highly benefit from the merge). This patch actually removes more lines than it adds ones.

The ContextBuilder still exists, because it implements features used in DeclarationBuilder and UseBuilder that need to be kept factorized. There are also methods of AbstractContextBuilder that are declared pure virtual, so an implementation of AbstractContextBuilder is needed.

Finally, this patch changes UseBuilder so that it uses TopDUContext::findContextAt to find the context in which an identifier appears. Before this patch, UseBuilder relied on ContextBuilder, that reopened the contexts when needed.


Diffs
-----

  duchain/usebuilder.cpp bd31f35 
  duchain/tests/testcontexts.cpp 2fbd7cf 
  duchain/parsesession.cpp 6fbdd91 
  duchain/parsesession.h 5f6c681 
  duchain/declarationbuilder.cpp d2d5b02 
  duchain/declarationbuilder.h fd56605 
  duchain/contextbuilder.cpp 091a799 
  duchain/contextbuilder.h 3a0ed0f 

Diff: https://git.reviewboard.kde.org/r/118325/diff/


Testing
-------

The whole testsuite passes, with ContextBuilder replaced by DeclarationBuilder in testcontexts. This is needed because ContextBuilder does not create any context anymore, so testcontexts has to use DeclarationBuilder.


Thanks,

Denis Steckelmacher

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20140526/c69c15bb/attachment.html>


More information about the KDevelop-devel mailing list