@@ -200,30 +200,22 @@ class CreateStruct {
200200 // Represents an entry.
201201 class Entry {
202202 public:
203+ using KeyKind = absl::variant<std::string, std::unique_ptr<Expr>>;
203204 Entry () {}
204- Entry (int64_t id,
205- absl::variant<std::string, std::unique_ptr<Expr>> key_kind,
206- std::unique_ptr<Expr> value)
205+ Entry (int64_t id, KeyKind key_kind, std::unique_ptr<Expr> value)
207206 : id_(id), key_kind_(std::move(key_kind)), value_(std::move(value)) {}
208207
209208 void set_id (int64_t id) { id_ = id; }
210209
211- void set_key_kind (
212- absl::variant<std::string, std::unique_ptr<Expr>> key_kind) {
213- key_kind_ = std::move (key_kind);
214- }
210+ void set_key_kind (KeyKind key_kind) { key_kind_ = std::move (key_kind); }
215211
216212 void set_value (std::unique_ptr<Expr> value) { value_ = std::move (value); }
217213
218214 int64_t id () const { return id_; }
219215
220- const absl::variant<std::string, std::unique_ptr<Expr>>& key_kind () const {
221- return key_kind_;
222- }
216+ const KeyKind& key_kind () const { return key_kind_; }
223217
224- absl::variant<std::string, std::unique_ptr<Expr>>& mutable_key_kind () {
225- return key_kind_;
226- }
218+ KeyKind& mutable_key_kind () { return key_kind_; }
227219
228220 const Expr* value () const { return value_.get (); }
229221
@@ -240,7 +232,7 @@ class CreateStruct {
240232 // information and other attributes to the node.
241233 int64_t id_;
242234 // The `Entry` key kinds.
243- absl::variant<std::string, std::unique_ptr<Expr>> key_kind_;
235+ KeyKind key_kind_;
244236 // Required. The value assigned to the key.
245237 std::unique_ptr<Expr> value_;
246238 };
@@ -759,6 +751,7 @@ class FunctionType {
759751//
760752// TODO(issues/5): decide on final naming for this.
761753class AbstractType {
754+ public:
762755 AbstractType (std::string name, std::vector<Type> parameter_types)
763756 : name_(std::move(name)), parameter_types_(std::move(parameter_types)) {}
764757
@@ -791,7 +784,7 @@ class PrimitiveTypeWrapper {
791784
792785 const PrimitiveType& type () const { return type_; }
793786
794- PrimitiveType& type () { return type_; }
787+ PrimitiveType& mutable_type () { return type_; }
795788
796789 private:
797790 PrimitiveType type_;
@@ -807,7 +800,7 @@ class MessageType {
807800
808801 void set_type (std::string type) { type_ = std::move (type); }
809802
810- const std::string& type () { return type_; }
803+ const std::string& type () const { return type_; }
811804
812805 private:
813806 std::string type_;
@@ -824,7 +817,7 @@ class ParamType {
824817
825818 void set_type (std::string type) { type_ = std::move (type); }
826819
827- const std::string& type () { return type_; }
820+ const std::string& type () const { return type_; }
828821
829822 private:
830823 std::string type_;
0 commit comments