code: public static ExtensionRegistry addToRegistry(final Descriptor descriptor,
        final ExtensionRegistry registry) {
      for (final FieldDescriptor extension : descriptor.getExtensions()) {
        addToRegistry(extension, registry);
      }
  
      for (final Descriptor child : descriptor.getNestedTypes()) {
        addToRegistry(child, registry);
      }
  
      return registry;
    }
docs: Adds all extensions for the given Descriptor to the registry.