//
// 1. create new private binder, using the elements source token
// 2. for all elements, apply each element to the private binder
// 3. re-expose any exposed keys using their exposed source token
final PrivateBinder privateBinder = binder.withSource( elements.getSource() ).newPrivateBinder();
final ElementAnalyzer privateAnalyzer = new ElementAnalyzer( privateBinder );
privateAnalyzers.add( privateAnalyzer );
// ignore bindings already in the parent
privateAnalyzer.ignoreKeys( localKeys );
for ( final Element e : elements.getElements() )
{
e.acceptVisitor( privateAnalyzer );
}
for ( final Key<?> k : elements.getExposedKeys() )
{
// only expose valid bindings that won't conflict with existing ones
if ( privateAnalyzer.localKeys.contains( k ) && localKeys.add( k ) )
{
privateBinder.withSource( elements.getExposedSource( k ) ).expose( k );
}
}
return null;
}