From 83286cccd224bd7ccd89f42c68c0935c9d2614b8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 9 Nov 2014 16:26:52 +1100 Subject: [PATCH] use file node builder and save parents to ast tree --- lib/6to5/util.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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);