handle_codeblock.cpp 788 B

12345678910111213141516171819202122232425
  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/check/context.h"
  5. #include "toolchain/check/handle.h"
  6. #include "toolchain/check/unused.h"
  7. namespace Carbon::Check {
  8. auto HandleParseNode(Context& context, Parse::CodeBlockStartId node_id)
  9. -> bool {
  10. context.node_stack().Push(node_id);
  11. context.scope_stack().PushForSameRegion();
  12. return true;
  13. }
  14. auto HandleParseNode(Context& context, Parse::CodeBlockId /*node_id*/) -> bool {
  15. context.scope_stack().Pop(/*check_unused=*/true);
  16. context.node_stack()
  17. .PopAndDiscardSoloNodeId<Parse::NodeKind::CodeBlockStart>();
  18. return true;
  19. }
  20. } // namespace Carbon::Check