mirror of https://github.com/sbt/sbt.git
More cleanup.
This commit is contained in:
parent
6d0c2c8d33
commit
1c63847a3d
|
|
@ -140,7 +140,7 @@ object EvaluateConfigurations
|
|||
}
|
||||
loader => {
|
||||
val coord = SourceCoord(name, line + 1)
|
||||
result.getValue(loader).asInstanceOf[Project.SettingsDefinition].settings map (_ setPos coord)
|
||||
result.getValue(loader).asInstanceOf[Project.SettingsDefinition].settings map (_ withPos coord)
|
||||
}
|
||||
}
|
||||
private[this] def isSpace = (c: Char) => Character isWhitespace c
|
||||
|
|
|
|||
|
|
@ -274,14 +274,15 @@ 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 =>
|
||||
val posDefined = c.settings filter (_.pos ne NoPosition)
|
||||
def fmt(s: Setting[_]) = s.pos match {
|
||||
case SourceCoord(fileName, line) => Some(fileName + ":" + line)
|
||||
case NoPosition => None
|
||||
}
|
||||
val posDefined = c.settings.map(fmt).flatten
|
||||
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 + (posDefined map fmt mkString ("\n\t", "\n\t", "\n"))
|
||||
header + (posDefined mkString ("\n\t", "\n\t", "\n"))
|
||||
} else ""
|
||||
} getOrElse ""
|
||||
|
||||
|
|
|
|||
|
|
@ -255,13 +255,13 @@ trait Init[Scope]
|
|||
def mapKey(g: MapScoped): Setting[T] = new Setting(g(key), init, pos)
|
||||
def mapInit(f: (ScopedKey[T], T) => T): Setting[T] = new Setting(key, init(t => f(key,t)), pos)
|
||||
def mapConstant(g: MapConstant): Setting[T] = new Setting(key, init mapConstant g, pos)
|
||||
def setPos(pos: SourceCoord) = new Setting(key, init, pos)
|
||||
def withPos(pos: SourceCoord) = new Setting(key, init, pos)
|
||||
override def toString = "setting(" + key + ") at " + pos
|
||||
}
|
||||
|
||||
sealed trait SourcePosition
|
||||
case object NoPosition extends SourcePosition
|
||||
case class SourceCoord(fileName: String, line: Int) extends SourcePosition
|
||||
final case class SourceCoord(fileName: String, line: Int) extends SourcePosition
|
||||
|
||||
// mainly for reducing generated class count
|
||||
private[this] def validateReferencedT(g: ValidateRef) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue