Generate SourceMap entries before and after tree branch processing.

We were missing the endings of trees. Fixes #766.