return vanilla object instead of modifying the recast PrintResult

This commit is contained in:
Sebastian McKenzie 2014-10-14 11:44:36 +11:00
parent 04466e3fea
commit c9f56b838f

View File

@ -95,20 +95,22 @@ File.prototype.generate = function () {
var ast = this.ast; var ast = this.ast;
var result = util.generate(ast, opts); var result = util.generate(ast, opts);
var code = result.code;
if (this.shebang) { if (this.shebang) {
// add back shebang // add back shebang
result.code = this.shebang + result.code; code = this.shebang + code;
} }
if (opts.sourceMap === "inline") { if (opts.sourceMap === "inline") {
result.code += "\n" + util.sourceMapToComment(result.map); code += "\n" + util.sourceMapToComment(map);
} }
result.map = result.map || null; return {
result.ast = ast; code: code,
map: result.map || null,
return result; ast: ast
};
}; };
File.prototype.generateUid = function (name) { File.prototype.generateUid = function (name) {