diff options
author | Mahmoud Mohamed <mahadelr19@gmail.com> | 2023-03-08 02:57:24 +0300 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:09 +0100 |
commit | 3e0437dc981af591f46234fd2e3aebb3c60028cc (patch) | |
tree | c92aeda15be2c1ba1afd93779e6efc1b1c33fa02 /gcc/rust/hir | |
parent | eba557860627a8ce1bb37d1427469db99cb0c059 (diff) | |
download | gcc-3e0437dc981af591f46234fd2e3aebb3c60028cc.zip gcc-3e0437dc981af591f46234fd2e3aebb3c60028cc.tar.gz gcc-3e0437dc981af591f46234fd2e3aebb3c60028cc.tar.bz2 |
gccrs: hir: Provide basic handling for ReferencePattern in function parameter
Added an implementation for
`CompilePatternBindings::visit (HIR::ReferencePattern)` where we
dereference the initial expression and recurse.
Added an implementation for
`CompilePatternBindings::visit (HIR::IdentifierPattern)` as well since it's
the simplest base case.
In addition to this, a small refactor for the shared code in
`StructPattern` and `TupleStructPattern` visits was added as a helper
function called `create_tmp_param_var`.
gcc/rust/ChangeLog:
* backend/rust-compile-fnparam.cc (CompileFnParam::visit):
Added visit implementation for ReferencePattern.
(CompileFnParam::create_tmp_param_var):
Refactored duplicated code into a helper function.
* backend/rust-compile-fnparam.h: Added visit implementation for
ReferencePattern.
* backend/rust-compile-pattern.cc (CompilePatternBindings::visit):
Added visit implementation for ReferencePattern and
IdentifierPattern.
* backend/rust-compile-pattern.h: Added visit implementation for
ReferencePattern and IdentifierPattern.
gcc/testsuite/ChangeLog:
* rust/compile/ref_pattern_fn_param.rs: Moved to...
* rust/compile/ref_pattern_fn_param1.rs: ...here.
* rust/compile/ref_pattern_fn_param2.rs: New test.
* rust/execute/torture/ref-pattern1.rs: New test.
Signed-off-by: Mahmoud Mohamed <mahadelr19@gmail.com>
Diffstat (limited to 'gcc/rust/hir')
0 files changed, 0 insertions, 0 deletions