@deprecated("Removed from the public API", "2.11.0") def isDefined: Boolean

This commit is contained in:
andrzej.jozwik@gmail.com 2014-10-01 08:56:43 +02:00 committed by Eugene Yokota
parent a67c5fd187
commit e230a17d3b
1 changed files with 10 additions and 9 deletions

View File

@ -82,16 +82,17 @@ private[sbt] case class SplitExpressionsNoBlankies(file: File, lines: Seq[String
}
def convertStatement(t: Tree): Option[(String, Tree, LineRange)] =
if (t.pos.isDefined) {
val originalStatement = modifiedContent.substring(t.pos.start, t.pos.end)
val statement = parseStatementAgain(t, originalStatement)
val numberLines = countLines(statement)
Some((statement, t, LineRange(t.pos.line - 1, t.pos.line + numberLines)))
} else {
None
t.pos match {
case NoPosition =>
None
case position =>
val originalStatement = modifiedContent.substring(position.start, position.end)
val statement = parseStatementAgain(t, originalStatement)
val numberLines = countLines(statement)
Some((statement, t, LineRange(position.line - 1, position.line + numberLines)))
}
val statementsTreeLineRange = statements flatMap convertStatement
(imports map convertImport, statementsTreeLineRange.map(t => (t._1, t._3)), statementsTreeLineRange.map(t => (t._1, t._2)), modifiedContent)
val stmtTreeLineRange = statements flatMap convertStatement
(imports map convertImport, stmtTreeLineRange.map { case (stmt, _, lr) => (stmt, lr) }, stmtTreeLineRange.map { case (stmt, tree, _) => (stmt, tree) }, modifiedContent)
}
private def countLines(statement: String) = statement.count(c => c == END_OF_LINE_CHAR)