Refactor ExtractUsedNames so it takes CompilationUnit

It turns out that we'll need an access to CompilationUnit in
subsequent commits. I'm setting the scene for that in this commit.
Extract used names both by tree walking and from dependencies

It turns out that the fact that typer inlines constants affects
not only dependency tracking but also used name extraction. In
retrospect it's obvious.

Therefore, we have to fallback on CompilationUnit.depends for
used names extraction as well.