diff --git a/lib/6to5/util.js b/lib/6to5/util.js index 4ecb4baa5b..423180c532 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -203,13 +203,11 @@ exports.parse = function (opts, code, callback) { estraverse.attachComments(ast, comments, tokens); - ast = { - type: "File", - program: ast, + ast = t.file(ast, comments, tokens); - comments: comments, - tokens: tokens, - }; + traverse(ast, function (node, parent) { + node._parent = parent; + }); if (callback) { return callback(ast);