1"use strict"; 2 3var attachComments = require("./attachComments"); 4var convertComments = require("./convertComments"); 5var toTokens = require("./toTokens"); 6var toAST = require("./toAST"); 7 8module.exports = function(ast, traverse, tt, code) { 9 // convert tokens 10 ast.tokens = toTokens(ast.tokens, tt, code); 11 12 // add comments 13 convertComments(ast.comments); 14 15 // transform esprima and acorn divergent nodes 16 toAST(ast, traverse, code); 17 18 // ast.program.tokens = ast.tokens; 19 // ast.program.comments = ast.comments; 20 // ast = ast.program; 21 22 // remove File 23 ast.type = "Program"; 24 ast.sourceType = ast.program.sourceType; 25 ast.directives = ast.program.directives; 26 ast.body = ast.program.body; 27 delete ast.program; 28 29 attachComments(ast, ast.comments, ast.tokens); 30}; 31