import.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. const SemIR::File& import_sem_ir) -> void;
  17. // Adds another package's imports to name lookup, with all libraries together.
  18. // This only adds the package name to lookup, so that `package.ImportedPackage`
  19. // will resolve, and will provide a name scope that can be used for further
  20. // qualified name lookups.
  21. //
  22. // import_irs may be empty. has_load_error is used to indicate if any library in
  23. // the package failed to import correctly.
  24. auto ImportLibrariesFromOtherPackage(Context& context,
  25. SemIR::TypeId namespace_type_id,
  26. Parse::ImportDirectiveId node_id,
  27. IdentifierId package_id,
  28. llvm::ArrayRef<SemIR::ImportIR> import_irs,
  29. bool has_load_error) -> void;
  30. } // namespace Carbon::Check
  31. #endif // CARBON_TOOLCHAIN_CHECK_IMPORT_H_