Skip to content

Commit 8507a68

Browse files
bors[bot]philberty
andauthored
Merge #837
837: HIR::IdentifierPattern had all fields public r=philberty a=philberty This makes the fields private again and adds the missing getter for the identifier. Co-authored-by: Philip Herron <[email protected]>
2 parents 7615df7 + 3a8c585 commit 8507a68

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

gcc/rust/backend/rust-compile-fnparam.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ class CompileFnParam : public HIRCompileBase
4848
address_taken_context->lookup_addess_taken (
4949
param.get_mappings ().get_hirid (), &address_taken);
5050

51-
compiled_param
52-
= ctx->get_backend ()->parameter_variable (fndecl, pattern.variable_ident,
53-
decl_type, address_taken,
54-
locus);
51+
compiled_param = ctx->get_backend ()->parameter_variable (
52+
fndecl, pattern.get_identifier (), decl_type, address_taken, locus);
5553
}
5654

5755
private:

gcc/rust/backend/rust-compile-var-decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CompileVarDecl : public HIRCompileBase
5959
translated_type = ctx->get_backend ()->immutable_type (translated_type);
6060

6161
compiled_variable
62-
= ctx->get_backend ()->local_variable (fndecl, pattern.variable_ident,
62+
= ctx->get_backend ()->local_variable (fndecl, pattern.get_identifier (),
6363
translated_type, NULL /*decl_var*/,
6464
address_taken, locus);
6565
}

gcc/rust/hir/tree/rust-hir-pattern.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,13 @@ class LiteralPattern : public Pattern
6868
// Identifier pattern HIR node (bind value matched to a variable)
6969
class IdentifierPattern : public Pattern
7070
{
71-
public:
7271
Identifier variable_ident;
7372
bool is_ref;
7473
Mutability mut;
75-
76-
// bool has_pattern;
7774
std::unique_ptr<Pattern> to_bind;
78-
7975
Location locus;
8076

77+
public:
8178
std::string as_string () const override;
8279

8380
// Returns whether the IdentifierPattern has a pattern to bind.
@@ -126,6 +123,8 @@ class IdentifierPattern : public Pattern
126123

127124
void accept_vis (HIRVisitor &vis) override;
128125

126+
Identifier get_identifier () const { return variable_ident; }
127+
129128
protected:
130129
/* Use covariance to implement clone function as returning this object rather
131130
* than base */

0 commit comments

Comments
 (0)