@@ -2163,72 +2163,6 @@ class EnumItemStruct : public EnumItem
2163
2163
}
2164
2164
};
2165
2165
2166
- // A discriminant (numbered enum) item used in an "enum" tagged union
2167
- class EnumItemDiscriminant : public EnumItem
2168
- {
2169
- std::unique_ptr<Expr> expression;
2170
-
2171
- public:
2172
- EnumItemDiscriminant (Identifier variant_name, Visibility vis,
2173
- std::unique_ptr<Expr> expr,
2174
- std::vector<Attribute> outer_attrs, location_t locus)
2175
- : EnumItem (std::move (variant_name), std::move (vis),
2176
- std::move (outer_attrs), locus),
2177
- expression (std::move (expr))
2178
- {}
2179
-
2180
- // Copy constructor with clone
2181
- EnumItemDiscriminant (EnumItemDiscriminant const &other)
2182
- : EnumItem (other), expression (other.expression->clone_expr ())
2183
- {}
2184
-
2185
- // Overloaded assignment operator to clone
2186
- EnumItemDiscriminant &operator = (EnumItemDiscriminant const &other)
2187
- {
2188
- EnumItem::operator = (other);
2189
- expression = other.expression ->clone_expr ();
2190
- // variant_name = other.variant_name;
2191
- // outer_attrs = other.outer_attrs;
2192
-
2193
- return *this ;
2194
- }
2195
-
2196
- // move constructors
2197
- EnumItemDiscriminant (EnumItemDiscriminant &&other) = default;
2198
- EnumItemDiscriminant &operator = (EnumItemDiscriminant &&other) = default ;
2199
-
2200
- EnumItem::Kind get_enum_item_kind () const override
2201
- {
2202
- return EnumItem::Kind::Discriminant;
2203
- }
2204
-
2205
- std::string as_string () const override ;
2206
-
2207
- void accept_vis (ASTVisitor &vis) override ;
2208
-
2209
- bool has_expr () { return expression != nullptr ; }
2210
-
2211
- // TODO: is this better? Or is a "vis_block" better?
2212
- Expr &get_expr ()
2213
- {
2214
- rust_assert (expression != nullptr );
2215
- return *expression;
2216
- }
2217
-
2218
- std::unique_ptr<Expr> &get_expr_ptr ()
2219
- {
2220
- rust_assert (expression != nullptr );
2221
- return expression;
2222
- }
2223
-
2224
- protected:
2225
- // Clone function implementation as (not pure) virtual method
2226
- EnumItemDiscriminant *clone_item_impl () const override
2227
- {
2228
- return new EnumItemDiscriminant (*this );
2229
- }
2230
- };
2231
-
2232
2166
// AST node for Rust "enum" - tagged union
2233
2167
class Enum : public VisItem
2234
2168
{
0 commit comments