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 #ifndef RUST_COMPILE_RESOLVE_PATH
20 #define RUST_COMPILE_RESOLVE_PATH
22 #include "rust-compile-base.h"
27 class ResolvePathRef
: public HIRCompileBase
, public HIR::HIRPatternVisitor
30 static tree
Compile (HIR::QualifiedPathInExpression
&expr
, Context
*ctx
)
32 ResolvePathRef
resolver (ctx
);
33 expr
.accept_vis (resolver
);
34 return resolver
.resolved
;
37 static tree
Compile (HIR::PathInExpression
&expr
, Context
*ctx
)
39 ResolvePathRef
resolver (ctx
);
40 expr
.accept_vis (resolver
);
41 return resolver
.resolved
;
44 void visit (HIR::PathInExpression
&expr
) override
;
45 void visit (HIR::QualifiedPathInExpression
&expr
) override
;
47 // Empty visit for unused Pattern HIR nodes.
48 void visit (HIR::GroupedPattern
&) override
{}
49 void visit (HIR::IdentifierPattern
&) override
{}
50 void visit (HIR::LiteralPattern
&) override
{}
51 void visit (HIR::RangePattern
&) override
{}
52 void visit (HIR::ReferencePattern
&) override
{}
53 void visit (HIR::SlicePattern
&) override
{}
54 void visit (HIR::StructPattern
&) override
{}
55 void visit (HIR::TuplePattern
&) override
{}
56 void visit (HIR::TupleStructPattern
&) override
{}
57 void visit (HIR::WildcardPattern
&) override
{}
59 ResolvePathRef (Context
*ctx
)
60 : HIRCompileBase (ctx
), resolved (error_mark_node
)
63 tree
resolve (const HIR::PathIdentSegment
&final_segment
,
64 const Analysis::NodeMapping
&mappings
, Location locus
,
65 bool is_qualified_path
);
70 } // namespace Compile
73 #endif // RUST_COMPILE_RESOLVE_PATH