member.h 749 B

12345678910111213141516171819202122232425262728293031323334
  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. #ifndef EXECUTABLE_SEMANTICS_AST_MEMBER_H_
  5. #define EXECUTABLE_SEMANTICS_AST_MEMBER_H_
  6. #include <string>
  7. #include "executable_semantics/ast/expression.h"
  8. namespace Carbon {
  9. enum class MemberKind { FieldMember };
  10. struct Member {
  11. int line_num;
  12. MemberKind tag;
  13. union {
  14. struct {
  15. std::string* name;
  16. const Expression* type;
  17. } field;
  18. } u;
  19. };
  20. auto MakeField(int line_num, std::string name, const Expression* type)
  21. -> Member*;
  22. void PrintMember(Member* m);
  23. } // namespace Carbon
  24. #endif // EXECUTABLE_SEMANTICS_AST_MEMBER_H_