scala/scala — pull request #2805 by adriaanm (2013-08-08 19:11:21+00:00)
Title: Constructors refactoring [Rebase of #2715]

[Rebase of #2715]

Review by @JamesIry before 2.11.0-M5 window closes. I consider merging this PR a blocker.

The `constructors` phase has grown over time, with sub-transformations being added to the all-encompassing `transformClassTemplate()` on an as-needed basis.

This PR breaks that method apart, encapsulating each sub-transformation in a trait dedicated to it. Documentation has been thrown in, too.

This PR essentially plays again the commits of https://github.com/scala/scala/pull/2599
adapted to `Constructors.scala` in its current form.

Those commits were once merged into master, but had an ephemeral existence:
they were inadvertently *overwritten* by the merge of 2.10.2 into master,
see commit 767a25fe2178b00f494d55bdaae53535cd7fb57d

This PR is a pre-requisite for an upcoming re-submission of https://github.com/scala/scala/pull/2665 ,
to make anon-closures retain fewer heap objects (currently, in some cases, more objects are retained via outer-refs than really needed).

Please merge this PR before Constructors.scala drifts again.