From c9d2c17bc7e2db3baf87b7ac3f5997368a86dc92 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Thu, 23 Feb 2017 09:47:06 -0800 Subject: [PATCH] Fix tests on node 4 Turns out, if you don't put "use strict"; `const` behaves in a crazy way. --- src/comments.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/comments.js b/src/comments.js index 5e13ada69..86106b4f7 100644 --- a/src/comments.js +++ b/src/comments.js @@ -1,3 +1,5 @@ +"use strict"; + var assert = require("assert"); var types = require("ast-types"); var n = types.namedTypes; @@ -456,11 +458,11 @@ function printComment(commentPath) { } function findExpressionIndexForComment(expressions, comment) { - var match; + let match; const startPos = locStart(comment) - 1; const endPos = locEnd(comment) + 1; - for (var i = 0; i < expressions.length; ++i) { + for (let i = 0; i < expressions.length; ++i) { const range = getExpressionRange(expressions[i]) if (