handle_type.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include "toolchain/lower/function_context.h"
  5. #include "toolchain/sem_ir/typed_insts.h"
  6. namespace Carbon::Lower {
  7. auto HandleArrayType(FunctionContext& context, SemIR::InstId inst_id,
  8. SemIR::ArrayType /*inst*/) -> void {
  9. context.SetLocal(inst_id, context.GetTypeAsValue());
  10. }
  11. auto HandleAssociatedEntityType(FunctionContext& context, SemIR::InstId inst_id,
  12. SemIR::AssociatedEntityType /*inst*/) -> void {
  13. context.SetLocal(inst_id, context.GetTypeAsValue());
  14. }
  15. auto HandleClassType(FunctionContext& context, SemIR::InstId inst_id,
  16. SemIR::ClassType /*inst*/) -> void {
  17. context.SetLocal(inst_id, context.GetTypeAsValue());
  18. }
  19. auto HandleConstType(FunctionContext& context, SemIR::InstId inst_id,
  20. SemIR::ConstType /*inst*/) -> void {
  21. context.SetLocal(inst_id, context.GetTypeAsValue());
  22. }
  23. auto HandleExternType(FunctionContext& context, SemIR::InstId inst_id,
  24. SemIR::ExternType /*inst*/) -> void {
  25. context.SetLocal(inst_id, context.GetTypeAsValue());
  26. }
  27. auto HandleFacetTypeAccess(FunctionContext& context, SemIR::InstId inst_id,
  28. SemIR::FacetTypeAccess /*inst*/) -> void {
  29. context.SetLocal(inst_id, context.GetTypeAsValue());
  30. }
  31. auto HandleFloatType(FunctionContext& context, SemIR::InstId inst_id,
  32. SemIR::FloatType /*inst*/) -> void {
  33. context.SetLocal(inst_id, context.GetTypeAsValue());
  34. }
  35. auto HandleInterfaceType(FunctionContext& context, SemIR::InstId inst_id,
  36. SemIR::InterfaceType /*inst*/) -> void {
  37. context.SetLocal(inst_id, context.GetTypeAsValue());
  38. }
  39. auto HandleIntType(FunctionContext& context, SemIR::InstId inst_id,
  40. SemIR::IntType /*inst*/) -> void {
  41. context.SetLocal(inst_id, context.GetTypeAsValue());
  42. }
  43. auto HandlePointerType(FunctionContext& context, SemIR::InstId inst_id,
  44. SemIR::PointerType /*inst*/) -> void {
  45. context.SetLocal(inst_id, context.GetTypeAsValue());
  46. }
  47. auto HandleStructType(FunctionContext& context, SemIR::InstId inst_id,
  48. SemIR::StructType /*inst*/) -> void {
  49. context.SetLocal(inst_id, context.GetTypeAsValue());
  50. }
  51. auto HandleTupleType(FunctionContext& context, SemIR::InstId inst_id,
  52. SemIR::TupleType /*inst*/) -> void {
  53. context.SetLocal(inst_id, context.GetTypeAsValue());
  54. }
  55. auto HandleUnboundElementType(FunctionContext& context, SemIR::InstId inst_id,
  56. SemIR::UnboundElementType /*inst*/) -> void {
  57. context.SetLocal(inst_id, context.GetTypeAsValue());
  58. }
  59. } // namespace Carbon::Lower