diplomacy: replace LazyModule.stack with an optional scope
This commit is contained in:
@ -179,7 +179,7 @@ trait BindingScope
|
||||
|
||||
private case class ExpandedValue(path: Seq[String], labels: Seq[String], value: Seq[ResourceValue])
|
||||
private lazy val eval: Unit = {
|
||||
require (LazyModule.stack.isEmpty, "May not evaluate binding while still constructing LazyModules")
|
||||
require (!LazyModule.scope.isDefined, "May not evaluate binding while still constructing LazyModules")
|
||||
parentScope.foreach { _.eval }
|
||||
resourceBindings = parentScope.map(_.resourceBindings).getOrElse(Nil)
|
||||
BindingScope.active = Some(this)
|
||||
@ -224,7 +224,7 @@ trait BindingScope
|
||||
object BindingScope
|
||||
{
|
||||
protected[diplomacy] var active: Option[BindingScope] = None
|
||||
protected[diplomacy] def find(m: Option[LazyModule] = LazyModule.stack.headOption): Option[BindingScope] = m.flatMap {
|
||||
protected[diplomacy] def find(m: Option[LazyModule] = LazyModule.scope): Option[BindingScope] = m.flatMap {
|
||||
case s: BindingScope => Some(s)
|
||||
case x => find(x.parent)
|
||||
}
|
||||
|
Reference in New Issue
Block a user