1 // Copyright (C) 2020-2024 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"
23 #include "rust-hir-visitor.h"
28 class ResolvePathRef
: public HIRCompileBase
, public HIR::HIRPatternVisitor
31 static tree
Compile (HIR::QualifiedPathInExpression
&expr
, Context
*ctx
)
33 ResolvePathRef
resolver (ctx
);
34 expr
.accept_vis (resolver
);
35 return resolver
.resolved
;
38 static tree
Compile (HIR::PathInExpression
&expr
, Context
*ctx
)
40 ResolvePathRef
resolver (ctx
);
41 expr
.accept_vis (resolver
);
42 return resolver
.resolved
;
45 void visit (HIR::PathInExpression
&expr
) override
;
46 void visit (HIR::QualifiedPathInExpression
&expr
) override
;
48 // Empty visit for unused Pattern HIR nodes.
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::AltPattern
&) override
{}
55 void visit (HIR::StructPattern
&) override
{}
56 void visit (HIR::TuplePattern
&) override
{}
57 void visit (HIR::TupleStructPattern
&) override
{}
58 void visit (HIR::WildcardPattern
&) override
{}
60 ResolvePathRef (Context
*ctx
)
61 : HIRCompileBase (ctx
), resolved (error_mark_node
)
64 tree
resolve (const HIR::PathIdentSegment
&final_segment
,
65 const Analysis::NodeMapping
&mappings
, location_t locus
,
66 bool is_qualified_path
);
72 attempt_constructor_expression_lookup (TyTy::BaseType
*lookup
, Context
*ctx
,
73 const Analysis::NodeMapping
&mappings
,
74 location_t expr_locus
);
77 } // namespace Compile
80 #endif // RUST_COMPILE_RESOLVE_PATH