Port analyzer to D2.

Hope this works! It builds for me locally. No unittests though so I can't really test it.