minor additions

This commit is contained in:
Mark Harrah 2011-01-29 11:22:59 -05:00
parent 43dc6af4ce
commit 1c9caf40a3
2 changed files with 6 additions and 0 deletions

View File

@ -80,6 +80,7 @@ object Project extends Init[Scope]
def mapScope(f: Scope => Scope) = new (ScopedKey ~> ScopedKey) { def apply[T](key: ScopedKey[T]) =
ScopedKey( f(key.scope), key.key)
}
def resolveThis(thisScope: Scope) = mapScope(Scope.replaceThis(thisScope))
def transform(g: Scope => Scope, ss: Seq[Setting[_]]): Seq[Setting[_]] = {
val f = mapScope(g)
ss.map(_ mapKey f mapReferenced f)

View File

@ -221,6 +221,7 @@ object Scoped
implicit def t2ToApp2[A,B](t2: (ScopedSetting[A], ScopedSetting[B]) ): Apply2[A,B] = new Apply2(t2)
implicit def t3ToApp3[A,B,C](t3: (ScopedSetting[A], ScopedSetting[B], ScopedSetting[C]) ): Apply3[A,B,C] = new Apply3(t3)
implicit def t4ToApp4[A,B,C,D](t4: (ScopedSetting[A], ScopedSetting[B], ScopedSetting[C], ScopedSetting[D]) ): Apply4[A,B,C,D] = new Apply4(t4)
final class Apply[T] private(val toSetting: ScopedKey[T] => Setting[T])
@ -249,6 +250,10 @@ object Scoped
def apply[T](f: (A,B,C) => T) =
Apply(t3._1 :^: t3._2 :^: t3._3 :^: KNil){ case a :+: b :+: c :+: HNil => f(a,b,c) }
}
final class Apply4[A,B,C,D](t4: (ScopedSetting[A], ScopedSetting[B], ScopedSetting[C], ScopedSetting[D])) {
def apply[T](f: (A,B,C,D) => T) =
Apply(t4._1 :^: t4._2 :^: t4._3 :^: t4._4 :^: KNil){ case a :+: b :+: c :+: d :+: HNil => f(a,b,c,d) }
}
/*def unresolved(scope: Scope): Seq[String] = unresolvedProject(scope.project) ++ unresolvedThis(scope)
def unresolvedProject(ps: ScopeAxis[ProjectRef]): Seq[String] = ps match {