diff options
Diffstat (limited to 'gcc/rust/ast/rust-ast.cc')
-rw-r--r-- | gcc/rust/ast/rust-ast.cc | 209 |
1 files changed, 0 insertions, 209 deletions
diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index 360a9ce..90fe926 100644 --- a/gcc/rust/ast/rust-ast.cc +++ b/gcc/rust/ast/rust-ast.cc @@ -3049,203 +3049,6 @@ NamedFunctionParam::as_string () const return str; } -TraitItemFunc::TraitItemFunc (TraitItemFunc const &other) - : TraitItem (other.locus), outer_attrs (other.outer_attrs), decl (other.decl) -{ - node_id = other.node_id; - - // guard to prevent null dereference - if (other.block_expr != nullptr) - block_expr = other.block_expr->clone_block_expr (); -} - -TraitItemFunc & -TraitItemFunc::operator= (TraitItemFunc const &other) -{ - TraitItem::operator= (other); - outer_attrs = other.outer_attrs; - decl = other.decl; - locus = other.locus; - node_id = other.node_id; - - // guard to prevent null dereference - if (other.block_expr != nullptr) - block_expr = other.block_expr->clone_block_expr (); - else - block_expr = nullptr; - - return *this; -} -std::string -TraitItemFunc::as_string () const -{ - std::string str = append_attributes (outer_attrs, OUTER); - - str += "\n" + decl.as_string (); - - str += "\n Definition (block expr): "; - if (has_definition ()) - str += block_expr->as_string (); - else - str += "none"; - - return str; -} - -std::string -TraitFunctionDecl::as_string () const -{ - std::string str - = qualifiers.as_string () + "fn " + function_name.as_string (); - - // generic params - str += "\n Generic params: "; - if (generic_params.empty ()) - { - str += "none"; - } - else - { - for (const auto ¶m : generic_params) - { - // DEBUG: null pointer check - if (param == nullptr) - { - rust_debug ( - "something really terrible has gone wrong - null pointer " - "generic param in trait function decl."); - return "NULL_POINTER_MARK"; - } - - str += "\n " + param->as_string (); - } - } - - str += "\n Function params: "; - if (has_params ()) - { - for (const auto ¶m : function_params) - str += "\n " + param->as_string (); - } - else - { - str += "none"; - } - - str += "\n Return type: "; - if (has_return_type ()) - str += return_type->as_string (); - else - str += "none (void)"; - - str += "\n Where clause: "; - if (has_where_clause ()) - str += where_clause.as_string (); - else - str += "none"; - - return str; -} - -TraitItemMethod::TraitItemMethod (TraitItemMethod const &other) - : TraitItem (other.locus), outer_attrs (other.outer_attrs), decl (other.decl) -{ - node_id = other.node_id; - - // guard to prevent null dereference - if (other.block_expr != nullptr) - block_expr = other.block_expr->clone_block_expr (); -} - -TraitItemMethod & -TraitItemMethod::operator= (TraitItemMethod const &other) -{ - TraitItem::operator= (other); - outer_attrs = other.outer_attrs; - decl = other.decl; - locus = other.locus; - node_id = other.node_id; - - // guard to prevent null dereference - if (other.block_expr != nullptr) - block_expr = other.block_expr->clone_block_expr (); - else - block_expr = nullptr; - - return *this; -} - -std::string -TraitItemMethod::as_string () const -{ - std::string str = append_attributes (outer_attrs, OUTER); - - str += "\n" + decl.as_string (); - - str += "\n Definition (block expr): "; - if (has_definition ()) - str += block_expr->as_string (); - else - str += "none"; - - return str; -} - -std::string -TraitMethodDecl::as_string () const -{ - std::string str - = qualifiers.as_string () + "fn " + function_name.as_string (); - - // generic params - str += "\n Generic params: "; - if (generic_params.empty ()) - { - str += "none"; - } - else - { - for (const auto ¶m : generic_params) - { - // DEBUG: null pointer check - if (param == nullptr) - { - rust_debug ( - "something really terrible has gone wrong - null pointer " - "generic param in trait function decl."); - return "NULL_POINTER_MARK"; - } - - str += "\n " + param->as_string (); - } - } - - str += "\n Function params: "; - if (has_params ()) - { - for (const auto ¶m : function_params) - str += "\n " + param->as_string (); - } - else - { - str += "none"; - } - - str += "\n Return type: "; - if (has_return_type ()) - str += return_type->as_string (); - else - str += "none (void)"; - - str += "\n Where clause: "; - if (has_where_clause ()) - str += where_clause.as_string (); - else - str += "none"; - - return str; -} - std::string TraitItemConst::as_string () const { @@ -5018,18 +4821,6 @@ StaticItem::accept_vis (ASTVisitor &vis) } void -TraitItemFunc::accept_vis (ASTVisitor &vis) -{ - vis.visit (*this); -} - -void -TraitItemMethod::accept_vis (ASTVisitor &vis) -{ - vis.visit (*this); -} - -void TraitItemConst::accept_vis (ASTVisitor &vis) { vis.visit (*this); |