message: Decompose printDecorators helper function from genericPrint.
diff: @@ -146,39 +146,24 @@ exports.Printer = Printer;
  function genericPrint(path, options, printPath) {
  assert.ok(path instanceof FastPath);
  - var node = path.getValue();
  - var parts = [];
  - var needsParens = false;
  - var linesWithoutParens =
  + const node = path.getValue();
  + const parts = [];
  + const linesWithoutParens =
  genericPrintNoParens(path, options, printPath);
  if (! node || linesWithoutParens.isEmpty()) {
  return linesWithoutParens;
  }
  - if (node.decorators &&
  - node.decorators.length > 0 &&
  - // If the parent node is an export declaration, it will be
  - // responsible for printing node.decorators.
  - ! util.getParentExportDeclaration(path)) {
  -
  - path.each(function(decoratorPath) {
  - parts.push(printPath(decoratorPath), "\n");
  - }, "decorators");
  + let needsParens = false;
  + const decoratorsLines = printDecorators(path, printPath);
  - } else if (util.isExportDeclaration(node) &&
  - node.declaration &&
  - node.declaration.decorators) {
  - // Export declarations are responsible for printing any decorators
  - // that logically apply to node.declaration.
  - path.each(function(decoratorPath) {
  - parts.push(printPath(decoratorPath), "\n");
  - }, "declaration", "decorators");
  -
  - } else {
  + if (decoratorsLines.isEmpty()) {
  // Nodes with decorators can't have parentheses, so we can avoid
  // computing path.needsParens() except in this case.
  needsParens = path.needsParens();
  + } else {
  + parts.push(decoratorsLines);
  }
  if (needsParens) {
  @@ -2341,6 +2326,33 @@ function genericPrintNoParens(path, options, print) {
  return p;
  }
  +function printDecorators(path, printPath) {
  + const parts = [];
  + const node = path.getValue();
  +
  + if (node.decorators &&
  + node.decorators.length > 0 &&
  + // If the parent node is an export declaration, it will be
  + // responsible for printing node.decorators.
  + ! util.getParentExportDeclaration(path)) {
  +
  + path.each(function(decoratorPath) {
  + parts.push(printPath(decoratorPath), "\n");
  + }, "decorators");
  +
  + } else if (util.isExportDeclaration(node) &&
  + node.declaration &&
  + node.declaration.decorators) {
  + // Export declarations are responsible for printing any decorators
  + // that logically apply to node.declaration.
  + path.each(function(decoratorPath) {
  + parts.push(printPath(decoratorPath), "\n");
  + }, "declaration", "decorators");
  + }
  +
  + return concat(parts);
  +}
  +
  function printStatementSequence(path, options, print) {
  var inClassBody =
  namedTypes.ClassBody &&
  