diff --git a/babylon-to-espree/toTokens.js b/babylon-to-espree/toTokens.js index 1f06d3e5..f3c0e848 100644 --- a/babylon-to-espree/toTokens.js +++ b/babylon-to-espree/toTokens.js @@ -4,12 +4,13 @@ var toToken = require("./toToken"); module.exports = function (tokens, tt, code) { // transform tokens to type "Template" convertTemplateType(tokens, tt); - var transformedTokens = tokens.filter((token) => { - return token.type !== "CommentLine" && token.type !== "CommentBlock"; - }); - for (var i = 0, l = transformedTokens.length; i < l; i++) { - transformedTokens[i] = toToken(transformedTokens[i], tt, code); + var transformedTokens = []; + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + if (token.type !== "CommentLine" && token.type !== "CommentBlock") { + transformedTokens.push(toToken(token, tt, code)); + } } return transformedTokens;