import.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TOOLCHAIN_CHECK_IMPORT_H_
  5. #define CARBON_TOOLCHAIN_CHECK_IMPORT_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/parse/node_ids.h"
  8. #include "toolchain/sem_ir/file.h"
  9. namespace Carbon::Check {
  10. // Add imports from a single library in the current package. This pulls in all
  11. // names; conflicts for things such as `package.a.b.c` will be flagged even
  12. // though they are several layers deep.
  13. auto ImportLibraryFromCurrentPackage(Context& context,
  14. SemIR::TypeId namespace_type_id,
  15. Parse::ImportDirectiveId node_id,
  16. bool is_api_for_impl,
  17. const SemIR::File& import_sem_ir) -> void;
  18. // Adds another package's imports to name lookup, with all libraries together.
  19. // This only adds the package name to lookup, so that `package.ImportedPackage`
  20. // will resolve, and will provide a name scope that can be used for further
  21. // qualified name lookups.
  22. //
  23. // import_irs may be empty. has_load_error is used to indicate if any library in
  24. // the package failed to import correctly.
  25. auto ImportLibrariesFromOtherPackage(Context& context,
  26. SemIR::TypeId namespace_type_id,
  27. Parse::ImportDirectiveId node_id,
  28. IdentifierId package_id,
  29. llvm::ArrayRef<SemIR::ImportIR> import_irs,
  30. bool has_load_error) -> void;
  31. } // namespace Carbon::Check
  32. #endif // CARBON_TOOLCHAIN_CHECK_IMPORT_H_