Drop duplicated code to add source files and use CodeContext API
The TreeBuilder
contains a lot of code duplications with CodeContext
which is unfortunately hand-tailored and specialized for the needs of valadoc's API tree.
So rework 54ba304e and cherry-pick 881333fe again.
Those were reverted while it caused the regression #748 (closed)