This can be way more efficient: https://github.com/Constellation/escodegen/blob/f4f5f075baf22a67d6ca8f2ed008b6cdb9c64b86/escodegen.js#L215-L225