mirror of https://github.com/sbt/sbt.git
Change SourcePosition definition + minor cleanup.
This commit is contained in:
parent
aafa6a0740
commit
6d0c2c8d33
|
|
@ -274,12 +274,14 @@ object Project extends Init[Scope] with ProjectExtra
|
|||
}
|
||||
val comp = compiled(structure.settings, actual)(structure.delegates, structure.scopeLocal, display)
|
||||
val definedAt = comp get scoped map { c =>
|
||||
if (c.settings exists (_.pos ne NoPosition)) {
|
||||
val header = if (c.settings forall (_.pos ne NoPosition)) "Defined at:" else "Some of the definition places:"
|
||||
val posDefined = c.settings filter (_.pos ne NoPosition)
|
||||
if (posDefined.size > 0) {
|
||||
val header = if (posDefined.size == c.settings.size) "Defined at:" else
|
||||
"Some of the defining occurrences:"
|
||||
def fmt(s: Setting[_]) = s.pos match {
|
||||
case SourceCoord(fileName, line) => fileName + ":" + line
|
||||
}
|
||||
header + (c.settings filter (_.pos ne NoPosition) map fmt mkString ("\n\t", "\n\t", "\n"))
|
||||
header + (posDefined map fmt mkString ("\n\t", "\n\t", "\n"))
|
||||
} else ""
|
||||
} getOrElse ""
|
||||
|
||||
|
|
|
|||
|
|
@ -259,16 +259,8 @@ trait Init[Scope]
|
|||
override def toString = "setting(" + key + ") at " + pos
|
||||
}
|
||||
|
||||
trait SourcePosition {
|
||||
def fileName: String
|
||||
def line: Int
|
||||
}
|
||||
|
||||
case object NoPosition extends SourcePosition {
|
||||
override def fileName = throw new UnsupportedOperationException("NoPosition")
|
||||
override def line = throw new UnsupportedOperationException("NoPosition")
|
||||
}
|
||||
|
||||
sealed trait SourcePosition
|
||||
case object NoPosition extends SourcePosition
|
||||
case class SourceCoord(fileName: String, line: Int) extends SourcePosition
|
||||
|
||||
// mainly for reducing generated class count
|
||||
|
|
|
|||
Loading…
Reference in New Issue