From 49276efb07ef18098c0f72970acf523a1fc31eb8 Mon Sep 17 00:00:00 2001 From: Arthur Cohen Date: Fri, 24 Jun 2022 11:54:08 +0200 Subject: ast: Keep ConstGenericArg as default value for ConstGenericParam --- gcc/rust/ast/rust-ast.h | 69 ------------------------------------------------- 1 file changed, 69 deletions(-) (limited to 'gcc/rust/ast/rust-ast.h') diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h index 51fe3c4..461a246 100644 --- a/gcc/rust/ast/rust-ast.h +++ b/gcc/rust/ast/rust-ast.h @@ -1344,75 +1344,6 @@ protected: } }; -/** - * Representation of const generic parameters - */ -class ConstGenericParam : public GenericParam -{ - /* Name of the parameter */ - Identifier name; - - /* Mandatory type of the const parameter - a null pointer is an error */ - std::unique_ptr type; - - /** - * Default value for the const generic parameter - nullptr indicates a lack - * of default value, not an error, as these errors are reported during - * parsing. - */ - std::unique_ptr default_value; - - Attribute outer_attr; - Location locus; - -public: - ConstGenericParam (Identifier name, std::unique_ptr type, - std::unique_ptr default_value, - Attribute outer_attr, Location locus) - : name (name), type (std::move (type)), - default_value (std::move (default_value)), outer_attr (outer_attr), - locus (locus) - {} - - ConstGenericParam (const ConstGenericParam &other) - : GenericParam (), name (other.name), type (other.type->clone_type ()), - outer_attr (other.outer_attr), locus (other.locus) - { - if (other.default_value) - default_value = other.default_value->clone_expr (); - } - - bool has_type () { return type != nullptr; } - bool has_default_value () { return default_value != nullptr; } - - const Identifier &get_name () const { return name; } - - std::unique_ptr &get_type () - { - rust_assert (has_type ()); - - return type; - } - - std::unique_ptr &get_default_value () { return default_value; } - - std::string as_string () const override; - - void accept_vis (ASTVisitor &vis) override; - - Location get_locus () const override final { return locus; } - - Kind get_kind () const override final { return Kind::Const; } - -protected: - /* Use covariance to implement clone function as returning this object rather - * than base */ - ConstGenericParam *clone_generic_param_impl () const override - { - return new ConstGenericParam (*this); - } -}; - // A macro item AST node - abstract base class class MacroItem : public Item { -- cgit v1.1