semantics_handle_parameter_list.cpp 2.1 KB

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