Port analyzer to D2.

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