handle_adapt.cpp 810 B

123456789101112131415161718192021
  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/parse/context.h"
  5. namespace Carbon::Parse {
  6. // Handles processing of a complete `adapt T` declaration.
  7. auto HandleAdaptDecl(Context& context) -> void {
  8. // TODO: This is identical to HandleBaseDecl other than the `NodeKind`,
  9. // and very similar to `HandleNamespaceFinish` and `HandleAliasFinish`.
  10. // We should factor out this common work.
  11. auto state = context.PopState();
  12. context.AddNodeExpectingDeclSemi(state, NodeKind::AdaptDecl,
  13. Lex::TokenKind::Adapt,
  14. /*is_def_allowed=*/false);
  15. }
  16. } // namespace Carbon::Parse