Add missing explanatory comment in ForStatement case (#748)

* Add missing explanatory comment in ForStatement case :notepad-spiral:.

* Update comment 🚀.
master
Davy Duperron 2017-02-20 16:15:46 +01:00 committed by James Long
parent 77f6f4de68
commit de8873ab23
1 changed files with 3 additions and 0 deletions

View File

@ -989,6 +989,9 @@ function genericPrintNoParens(path, options, print) {
case "ForStatement": {
const body = adjustClause(path.call(print, "body"), options);
// We want to keep dangling comments above the loop to stay consistent.
// Any comment positioned between the for statement and the parentheses
// is going to be printed before the statement.
const dangling = comments.printDanglingComments(path, options, /* sameLine */ true);
const printedComments = dangling ? concat([dangling, softline]) : "";