Port of original cpp codegen infrastructure to dart