member_access.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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_MEMBER_ACCESS_H_
  5. #define CARBON_TOOLCHAIN_CHECK_MEMBER_ACCESS_H_
  6. #include "toolchain/check/context.h"
  7. #include "toolchain/sem_ir/ids.h"
  8. namespace Carbon::Check {
  9. // Creates SemIR to perform a member access with base expression `base_id` and
  10. // member name `name_id`. Returns the result of the access.
  11. auto PerformMemberAccess(Context& context, SemIR::LocId loc_id,
  12. SemIR::InstId base_id, SemIR::NameId name_id)
  13. -> SemIR::InstId;
  14. // Creates SemIR to perform a compound member access with base expression
  15. // `base_id` and member name expression `member_expr_id`. Returns the result of
  16. // the access. If specified, `missing_impl_diagnoser()` is used to build an
  17. // error diagnostic when impl binding fails due to a missing `impl`.
  18. auto PerformCompoundMemberAccess(
  19. Context& context, SemIR::LocId loc_id, SemIR::InstId base_id,
  20. SemIR::InstId member_expr_id,
  21. Context::BuildDiagnosticFn missing_impl_diagnoser = nullptr)
  22. -> SemIR::InstId;
  23. // Creates SemIR to perform a tuple index with base expression `tuple_inst_id`
  24. // and index expression `index_inst_id`. Returns the result of the access.
  25. auto PerformTupleAccess(Context& context, SemIR::LocId loc_id,
  26. SemIR::InstId tuple_inst_id,
  27. SemIR::InstId index_inst_id) -> SemIR::InstId;
  28. } // namespace Carbon::Check
  29. #endif // CARBON_TOOLCHAIN_CHECK_MEMBER_ACCESS_H_