1 // Copyright (C) 2020-2023 Free Software Foundation, Inc.
3 // This file is part of GCC.
5 // GCC is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 3, or (at your option) any later
10 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 // You should have received a copy of the GNU General Public License
16 // along with GCC; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 #include "rust-ast-resolve-struct-expr-field.h"
20 #include "rust-ast-resolve-expr.h"
26 ResolveStructExprField::go (AST::StructExprField
*field
,
27 const CanonicalPath
&prefix
,
28 const CanonicalPath
&canonical_prefix
)
30 ResolveStructExprField
resolver (prefix
, canonical_prefix
);
31 field
->accept_vis (resolver
);
34 ResolveStructExprField::ResolveStructExprField (
35 const CanonicalPath
&prefix
, const CanonicalPath
&canonical_prefix
)
36 : ResolverBase (), prefix (prefix
), canonical_prefix (canonical_prefix
)
40 ResolveStructExprField::visit (AST::StructExprFieldIdentifierValue
&field
)
42 ResolveExpr::go (field
.get_value ().get (), prefix
, canonical_prefix
);
46 ResolveStructExprField::visit (AST::StructExprFieldIndexValue
&field
)
48 ResolveExpr::go (field
.get_value ().get (), prefix
, canonical_prefix
);
52 ResolveStructExprField::visit (AST::StructExprFieldIdentifier
&field
)
54 AST::IdentifierExpr
expr (field
.get_field_name (), {}, field
.get_locus ());
55 expr
.set_node_id (field
.get_node_id ());
57 ResolveExpr::go (&expr
, prefix
, canonical_prefix
);
60 } // namespace Resolver