member.h 733 B

123456789101112131415161718192021222324252627282930313233
  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. Expression* type;
  17. } field;
  18. } u;
  19. };
  20. auto MakeField(int line_num, std::string name, Expression* type) -> Member*;
  21. void PrintMember(Member* m);
  22. } // namespace Carbon
  23. #endif // EXECUTABLE_SEMANTICS_AST_MEMBER_H_