mirror of https://github.com/sbt/sbt.git
More cleanup.
This commit is contained in:
parent
dc0a40c776
commit
d1c799cd09
|
|
@ -140,7 +140,7 @@ object EvaluateConfigurations
|
||||||
}
|
}
|
||||||
loader => {
|
loader => {
|
||||||
val coord = SourceCoord(name, line + 1)
|
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
|
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 comp = compiled(structure.settings, actual)(structure.delegates, structure.scopeLocal, display)
|
||||||
val definedAt = comp get scoped map { c =>
|
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) {
|
if (posDefined.size > 0) {
|
||||||
val header = if (posDefined.size == c.settings.size) "Defined at:" else
|
val header = if (posDefined.size == c.settings.size) "Defined at:" else
|
||||||
"Some of the defining occurrences:"
|
"Some of the defining occurrences:"
|
||||||
def fmt(s: Setting[_]) = s.pos match {
|
header + (posDefined mkString ("\n\t", "\n\t", "\n"))
|
||||||
case SourceCoord(fileName, line) => fileName + ":" + line
|
|
||||||
}
|
|
||||||
header + (posDefined map fmt mkString ("\n\t", "\n\t", "\n"))
|
|
||||||
} else ""
|
} else ""
|
||||||
} getOrElse ""
|
} getOrElse ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -255,13 +255,13 @@ trait Init[Scope]
|
||||||
def mapKey(g: MapScoped): Setting[T] = new Setting(g(key), init, pos)
|
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 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 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
|
override def toString = "setting(" + key + ") at " + pos
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed trait SourcePosition
|
sealed trait SourcePosition
|
||||||
case object NoPosition extends 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
|
// mainly for reducing generated class count
|
||||||
private[this] def validateReferencedT(g: ValidateRef) =
|
private[this] def validateReferencedT(g: ValidateRef) =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue