diff options
Diffstat (limited to 'gcc/rust/hir/rust-ast-lower-base.cc')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-base.cc | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 5f6d6fe..051dd60 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -21,6 +21,8 @@ #include "rust-ast-lower-pattern.h" #include "rust-ast-lower-extern.h" #include "rust-attribute-values.h" +#include "rust-item.h" +#include "rust-system.h" namespace Rust { namespace HIR { @@ -515,6 +517,18 @@ void ASTLoweringBase::visit (AST::BareFunctionType &) {} +void +ASTLoweringBase::visit (AST::FunctionParam ¶m) +{} + +void +ASTLoweringBase::visit (AST::VariadicParam ¶m) +{} + +void +ASTLoweringBase::visit (AST::SelfParam ¶m) +{} + HIR::Lifetime ASTLoweringBase::lower_lifetime (AST::Lifetime &lifetime) { @@ -629,28 +643,31 @@ ASTLoweringBase::lower_generic_args (AST::GenericArgs &args) } HIR::SelfParam -ASTLoweringBase::lower_self (AST::SelfParam &self) +ASTLoweringBase::lower_self (std::unique_ptr<AST::Param> ¶m) { + rust_assert (param->is_self ()); + + auto self = static_cast<AST::SelfParam *> (param.get ()); auto crate_num = mappings->get_current_crate (); - Analysis::NodeMapping mapping (crate_num, self.get_node_id (), + Analysis::NodeMapping mapping (crate_num, self->get_node_id (), mappings->get_next_hir_id (crate_num), mappings->get_next_localdef_id (crate_num)); - if (self.has_type ()) + if (self->has_type ()) { - HIR::Type *type = ASTLoweringType::translate (self.get_type ().get ()); + HIR::Type *type = ASTLoweringType::translate (self->get_type ().get ()); return HIR::SelfParam (mapping, std::unique_ptr<HIR::Type> (type), - self.get_is_mut (), self.get_locus ()); + self->get_is_mut (), self->get_locus ()); } - else if (!self.get_has_ref ()) + else if (!self->get_has_ref ()) { return HIR::SelfParam (mapping, std::unique_ptr<HIR::Type> (nullptr), - self.get_is_mut (), self.get_locus ()); + self->get_is_mut (), self->get_locus ()); } - AST::Lifetime l = self.get_lifetime (); - return HIR::SelfParam (mapping, lower_lifetime (l), self.get_is_mut (), - self.get_locus ()); + AST::Lifetime l = self->get_lifetime (); + return HIR::SelfParam (mapping, lower_lifetime (l), self->get_is_mut (), + self->get_locus ()); } HIR::Type * |