Working on declaration mapping.
Fix naming.
Move declaration emitting before ast emitting.