Refactor and clean up AST2XML pass.
Refactor and clean up AST2XML pass.

Migrated from Sable/mclab@c61f012897acc67e0ee1bbbd197023f349ba2ea6

Sable/mclab-core,Sable/mclab-core,Sable/mclab-core,Sable/mclab-core,Sable/mclab-core,Sable/mclab-core,Sable/mclab-core,Sable/mclab-core