private def printStats()

in rsc/src/main/scala/rsc/pretty/TreeStr.scala [813:864]


  private def printStats(statList: List[Stat]): Unit = {
    var i = 0
    val stats = statList.toArray
    while (i < stats.length) {
      val stat = stats(i)
      apply(stat)

      val notLast = i < stats.length - 1
      l match {
        case ScalaLanguage =>
          if (notLast) {
            stats(i + 1) match {
              case next: Term =>
                def needsSemicolon(prev: Option[Tree]): Boolean = prev match {
                  case Some(prev: DefnField) =>
                    needsSemicolon(prev.rhs)
                  case Some(prev: DefnMacro) =>
                    needsSemicolon(Some(prev.rhs))
                  case Some(prev: DefnMethod) =>
                    needsSemicolon(prev.rhs)
                  case Some(prev: DefnPat) =>
                    needsSemicolon(prev.rhs)
                  case Some(prev: TermApplyPostfix) =>
                    true
                  case Some(prev: Term) =>
                    next.isInstanceOf[TermBlock] ||
                      next.isInstanceOf[TermPartialFunction] ||
                      next.isInstanceOf[TermFunction]
                  case _ =>
                    false
                }
                if (needsSemicolon(Some(stat))) {
                  p.str(";")
                }
              case _ =>
                ()
            }
          }
        case JavaLanguage =>
          stat match {
            case _: DefnConstant =>
              if (notLast && stats(i + 1).isInstanceOf[DefnConstant]) p.str(",")
              else p.str(";")
            case _ =>
              ()
          }
      }
      if (notLast && !stats(i + 1).isInstanceOf[DefnConstant]) p.str(EOL)

      i += 1
    }
  }