Display sourcepos info when at least 1 pos known.

This commit is contained in:
Eugene Vigdorchik 2012-01-23 17:42:50 +04:00
parent 633f4736b3
commit f9da9e7def
1 changed files with 3 additions and 2 deletions

View File

@ -274,11 +274,12 @@ 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 forall (_.pos ne NoPosition)) {
if (c.settings exists (_.pos ne NoPosition)) {
val header = if (c.settings forall (_.pos ne NoPosition)) "Defined at:" else "Some of the definition places:"
def fmt(s: Setting[_]) = s.pos match {
case SourceCoord(fileName, line) => fileName + ":" + line
}
"Defined at:" + (c.settings map fmt mkString ("\n\t", "\n\t", "\n"))
header + (c.settings filter (_.pos ne NoPosition) map fmt mkString ("\n\t", "\n\t", "\n"))
} else ""
} getOrElse ""