diff options
author | Mahmoud Mohamed <mahadelr19@gmail.com> | 2023-03-08 02:57:24 +0300 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-03-14 10:24:48 +0000 |
commit | 43590461e0033ff677ba4f3bf90cd289cf0b2518 (patch) | |
tree | d269c94448e739baa252ebd64ccdf8cba34a535b /gcc/rust/resolve | |
parent | 362c6d7f14bfc84a670bd84a4ea11ae3da916fa9 (diff) | |
download | gcc-43590461e0033ff677ba4f3bf90cd289cf0b2518.zip gcc-43590461e0033ff677ba4f3bf90cd289cf0b2518.tar.gz gcc-43590461e0033ff677ba4f3bf90cd289cf0b2518.tar.bz2 |
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/resolve')
0 files changed, 0 insertions, 0 deletions