semantics_handle_parameter_list.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/semantics/semantics_context.h"
  5. namespace Carbon::Check {
  6. auto HandleDeducedParameterList(Context& context, ParseTree::Node parse_node)
  7. -> bool {
  8. return context.TODO(parse_node, "HandleDeducedParameterList");
  9. }
  10. auto HandleDeducedParameterListStart(Context& context,
  11. ParseTree::Node parse_node) -> bool {
  12. return context.TODO(parse_node, "HandleDeducedParameterListStart");
  13. }
  14. auto HandleParameterList(Context& context, ParseTree::Node parse_node) -> bool {
  15. auto refs_id = context.ParamOrArgEnd(
  16. /*for_args=*/false, ParseNodeKind::ParameterListStart);
  17. // TODO: This contains the IR block for parameters. At present, it's just
  18. // loose, but it's not strictly required for parameter refs; we should either
  19. // stop constructing it completely or, if it turns out to be needed, store it.
  20. // Note, the underlying issue is that the LLVM IR has nowhere clear to emit,
  21. // so changing storage would require addressing that problem. For comparison
  22. // with function calls, the IR needs to be emitted prior to the call.
  23. context.node_block_stack().Pop();
  24. context.PopScope();
  25. context.node_stack()
  26. .PopAndDiscardSoloParseNode<ParseNodeKind::ParameterListStart>();
  27. context.node_stack().Push(parse_node, refs_id);
  28. return true;
  29. }
  30. auto HandleParameterListComma(Context& context, ParseTree::Node /*parse_node*/)
  31. -> bool {
  32. context.ParamOrArgComma(/*for_args=*/false);
  33. return true;
  34. }
  35. auto HandleParameterListStart(Context& context, ParseTree::Node parse_node)
  36. -> bool {
  37. context.PushScope();
  38. context.node_stack().Push(parse_node);
  39. context.node_block_stack().Push();
  40. context.ParamOrArgStart();
  41. return true;
  42. }
  43. } // namespace Carbon::Check