diff options
author | Philip Herron <herron.philip@googlemail.com> | 2023-05-23 14:35:17 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:37:21 +0100 |
commit | 636e9b41035b55a138065398490ad9007b10fe06 (patch) | |
tree | e851b9945146ae925a1648cc985bece7a5748f65 /gcc/rust/backend/rust-compile-expr.cc | |
parent | b8934ebd88b50c6aae304eede565f94cb860a3c2 (diff) | |
download | gcc-636e9b41035b55a138065398490ad9007b10fe06.zip gcc-636e9b41035b55a138065398490ad9007b10fe06.tar.gz gcc-636e9b41035b55a138065398490ad9007b10fe06.tar.bz2 |
gccrs: refactor resolve_method_address to be more generic
We can reuse the DefId to lookup the mappings to Items or Trait Items
instead of the HirId this is more generic and can then be reused for the
deref operator overload during autoderef cycles.
Addresses #2190
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address): refactor
* backend/rust-compile-base.h: likewise
* backend/rust-compile-expr.cc (CompileExpr::visit): likewise
* backend/rust-compile-resolve-path.cc (HIRCompileBase::query_compile): likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 78448dd..00b9a07 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -1757,9 +1757,7 @@ CompileExpr::visit (HIR::MethodCallExpr &expr) // lookup compiled functions since it may have already been compiled HIR::PathExprSegment method_name = expr.get_method_name (); HIR::PathIdentSegment segment_name = method_name.get_segment (); - fn_expr - = resolve_method_address (fntype, ref, receiver, segment_name, - expr.get_mappings (), expr.get_locus ()); + fn_expr = resolve_method_address (fntype, receiver, expr.get_locus ()); } // lookup the autoderef mappings @@ -1899,9 +1897,7 @@ CompileExpr::resolve_operator_overload ( // lookup compiled functions since it may have already been compiled HIR::PathIdentSegment segment_name ( Analysis::RustLangItem::ToString (lang_item_type)); - tree fn_expr - = resolve_method_address (fntype, ref, receiver, segment_name, - expr.get_mappings (), expr.get_locus ()); + tree fn_expr = resolve_method_address (fntype, receiver, expr.get_locus ()); // lookup the autoderef mappings std::vector<Resolver::Adjustment> *adjustments = nullptr; |