handle_type.cpp 1.1 KB

123456789101112131415161718192021222324252627282930
  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. #include "toolchain/parse/handle.h"
  6. namespace Carbon::Parse {
  7. // Handles processing of a type declaration or definition after its introducer.
  8. static auto HandleTypeAfterIntroducer(Context& context,
  9. State after_params_state) -> void {
  10. auto state = context.PopState();
  11. context.PushState(state, after_params_state);
  12. context.PushState(State::DeclNameAndParams, state.token);
  13. }
  14. auto HandleTypeAfterIntroducerAsClass(Context& context) -> void {
  15. HandleTypeAfterIntroducer(context, State::DeclOrDefinitionAsClass);
  16. }
  17. auto HandleTypeAfterIntroducerAsInterface(Context& context) -> void {
  18. HandleTypeAfterIntroducer(context, State::DeclOrDefinitionAsInterface);
  19. }
  20. auto HandleTypeAfterIntroducerAsNamedConstraint(Context& context) -> void {
  21. HandleTypeAfterIntroducer(context, State::DeclOrDefinitionAsNamedConstraint);
  22. }
  23. } // namespace Carbon::Parse