diff --git a/lib/6to5/util.js b/lib/6to5/util.js index 39749b08cc..ae267180dd 100644 --- a/lib/6to5/util.js +++ b/lib/6to5/util.js @@ -111,6 +111,11 @@ exports.template = function (name, nodes, keepExpression) { var template = exports.templates[name]; if (!template) throw new ReferenceError("unknown template " + name); + if (nodes === true) { + keepExpression = true; + nodes = null; + } + template = _.cloneDeep(template); var inherits = false; @@ -192,13 +197,14 @@ exports.parse = function (opts, code, callback) { var tokens = []; var ast = acorn.parse(code, { - preserveParens: true, - ecmaVersion: Infinity, - strictMode: true, - onComment: comments, - locations: true, - onToken: tokens, - ranges: true + allowReturnOutsideFunction: true, + preserveParens: true, + ecmaVersion: Infinity, + strictMode: true, + onComment: comments, + locations: true, + onToken: tokens, + ranges: true }); estraverse.attachComments(ast, comments, tokens);