Skip to content

Commit c565e97

Browse files
committed
gccrs: Lower IdentifierPattern's to_bind to HIR
gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc: Lower of IdentifierPattern's to_bind to HIR. * hir/rust-hir-dump.cc: Update IdentifierPattern's dump to properly show to_bind's full full properties. Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
1 parent 6638ae7 commit c565e97

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

gcc/rust/hir/rust-ast-lower-pattern.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ ASTLoweringPattern::visit (AST::IdentifierPattern &pattern)
5050
UNKNOWN_LOCAL_DEFID);
5151

5252
std::unique_ptr<Pattern> to_bind;
53+
if (pattern.has_pattern_to_bind ())
54+
55+
{
56+
to_bind = std::unique_ptr<Pattern> (
57+
Add commentMore actions
58+
59+
ASTLoweringPattern::translate (pattern.get_pattern_to_bind ()));
60+
}
5361
translated
5462
= new HIR::IdentifierPattern (mapping, pattern.get_ident (),
5563
pattern.get_locus (), pattern.get_is_ref (),

gcc/rust/hir/rust-hir-dump.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2114,7 +2114,7 @@ Dump::visit (IdentifierPattern &e)
21142114
put_field ("mut", std::to_string (e.is_mut ()));
21152115

21162116
if (e.has_pattern_to_bind ())
2117-
put_field ("to_bind", e.get_to_bind ().as_string ());
2117+
visit_field ("to_bind", e.get_to_bind ());
21182118
else
21192119
put_field ("to_bind", "none");
21202120

0 commit comments

Comments
 (0)