handle_import_and_package.cpp 1.4 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/check/context.h"
  5. namespace Carbon::Check {
  6. // `import` and `package` are structured by parsing. As a consequence, no
  7. // checking logic is needed here.
  8. auto HandleImportIntroducer(Context& /*context*/, Parse::Node /*parse_node*/)
  9. -> bool {
  10. return true;
  11. }
  12. auto HandlePackageIntroducer(Context& /*context*/, Parse::Node /*parse_node*/)
  13. -> bool {
  14. return true;
  15. }
  16. auto HandleLibrary(Context& context, Parse::Node /*parse_node*/) -> bool {
  17. // Pop and discard the library name from the node stack.
  18. context.node_stack().Pop<Parse::NodeKind::Literal>();
  19. return true;
  20. }
  21. auto HandlePackageApi(Context& /*context*/, Parse::Node /*parse_node*/)
  22. -> bool {
  23. return true;
  24. }
  25. auto HandlePackageImpl(Context& /*context*/, Parse::Node /*parse_node*/)
  26. -> bool {
  27. return true;
  28. }
  29. auto HandleImportDirective(Context& context, Parse::Node /*parse_node*/)
  30. -> bool {
  31. // Pop and discard the identifier from the node stack.
  32. context.node_stack().Pop<Parse::NodeKind::Name>();
  33. return true;
  34. }
  35. auto HandlePackageDirective(Context& context, Parse::Node /*parse_node*/)
  36. -> bool {
  37. // Pop and discard the identifier from the node stack.
  38. context.node_stack().Pop<Parse::NodeKind::Name>();
  39. return true;
  40. }
  41. } // namespace Carbon::Check