handle_type.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 HandleFacetTypeAccess(FunctionContext& context, SemIR::InstId inst_id,
  24. SemIR::FacetTypeAccess /*inst*/) -> void {
  25. context.SetLocal(inst_id, context.GetTypeAsValue());
  26. }
  27. auto HandleInterfaceType(FunctionContext& context, SemIR::InstId inst_id,
  28. SemIR::InterfaceType /*inst*/) -> void {
  29. context.SetLocal(inst_id, context.GetTypeAsValue());
  30. }
  31. auto HandleIntType(FunctionContext& context, SemIR::InstId inst_id,
  32. SemIR::IntType /*inst*/) -> void {
  33. context.SetLocal(inst_id, context.GetTypeAsValue());
  34. }
  35. auto HandlePointerType(FunctionContext& context, SemIR::InstId inst_id,
  36. SemIR::PointerType /*inst*/) -> void {
  37. context.SetLocal(inst_id, context.GetTypeAsValue());
  38. }
  39. auto HandleStructType(FunctionContext& context, SemIR::InstId inst_id,
  40. SemIR::StructType /*inst*/) -> void {
  41. context.SetLocal(inst_id, context.GetTypeAsValue());
  42. }
  43. auto HandleTupleType(FunctionContext& context, SemIR::InstId inst_id,
  44. SemIR::TupleType /*inst*/) -> void {
  45. context.SetLocal(inst_id, context.GetTypeAsValue());
  46. }
  47. auto HandleUnboundElementType(FunctionContext& context, SemIR::InstId inst_id,
  48. SemIR::UnboundElementType /*inst*/) -> void {
  49. context.SetLocal(inst_id, context.GetTypeAsValue());
  50. }
  51. } // namespace Carbon::Lower