member.cpp 639 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 "executable_semantics/ast/member.h"
  5. #include "executable_semantics/common/arena.h"
  6. #include "llvm/Support/Casting.h"
  7. namespace Carbon {
  8. using llvm::cast;
  9. Member::~Member() = default;
  10. void Member::Print(llvm::raw_ostream& out) const {
  11. switch (kind()) {
  12. case MemberKind::FieldMember:
  13. const auto& field = cast<FieldMember>(*this);
  14. out << "var " << field.binding() << ";\n";
  15. break;
  16. }
  17. }
  18. } // namespace Carbon