class_definition.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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_CLASS_DEFINITION_H_
  5. #define EXECUTABLE_SEMANTICS_AST_CLASS_DEFINITION_H_
  6. #include <string>
  7. #include <vector>
  8. #include "executable_semantics/ast/member.h"
  9. #include "executable_semantics/ast/source_location.h"
  10. namespace Carbon {
  11. class ClassDefinition {
  12. public:
  13. ClassDefinition(SourceLocation source_loc, std::string name,
  14. std::vector<Nonnull<Member*>> members)
  15. : source_loc_(source_loc),
  16. name_(std::move(name)),
  17. members_(std::move(members)) {}
  18. auto source_loc() const -> SourceLocation { return source_loc_; }
  19. auto name() const -> const std::string& { return name_; }
  20. auto members() const -> llvm::ArrayRef<Nonnull<Member*>> { return members_; }
  21. private:
  22. SourceLocation source_loc_;
  23. std::string name_;
  24. std::vector<Nonnull<Member*>> members_;
  25. };
  26. } // namespace Carbon
  27. #endif // EXECUTABLE_SEMANTICS_AST_CLASS_DEFINITION_H_