module T::Private::Methods

def self._with_declared_signature(mod, declblock, &blk)

def self._with_declared_signature(mod, declblock, &blk)
  # If declblock is provided, this code is equivalent to the check in
  # _declare_sig_internal, above.
  # If declblock is not provided and we have an active declaration, we are
  # obviously doing something wrong.
  if T::Private::DeclState.current.active_declaration
    T::Private::DeclState.current.reset!
    raise "You called sig twice without declaring a method in between"
  end
  if declblock
    T::Private::DeclState.current.active_declaration = declblock
  end
  mod.module_exec(&blk)
end