code: private boolean canExposeKeyFrom(Key<?> key, GinjectorBindings child, boolean pinned) {
      GinjectorBindings parent = child.getParent();
  
      if (parent == null) {
        // Can't move above the root.
        return false;
      } else if (parent.isBoundLocallyInChild(key)) {
        // If a sibling module already materialized a binding for this key, we
        // can't float over it.
        return false;
      } else if (pinned) {
        // If a key is pinned, it's visible in the parent iff it has an
        // ExposedChildBinding pointing at the child.
        Binding binding = parent.getBinding(key);
        if (binding == null) {
          return false;
        } else if (!(binding instanceof ExposedChildBinding)) {
          // This should never happen (it would have been caught as a
          // double-binding earlier).
          throw new RuntimeException("Unexpected binding shadowing a pinned binding: " + binding);
        } else {
          ExposedChildBinding exposedChildBinding = (ExposedChildBinding) binding;
          if (exposedChildBinding.getChildBindings() != child) {
            throw new RuntimeException(
                "Unexpected exposed child binding shadowing a pinned binding: " + binding);
          } else {
            return true;
          }
        }
      } else {
        return true;
      }
    }
docs: Tests whether a key from the given child injector can be made visible in
  its parent.  For pinned keys, this means that they're exposed to the
  parent; for keys that aren't pinned, it means that there's no other
  constraint preventing them from floating up.
  
  <p>Note that "pinned" states whether the key was pinned in the injector it
  started in; it might not be pinned in child.